Delphi to C# - Any decent tool to do some hard core conversion?
I've tried a couple of options available out there, such as Netcoole's Delphi2CS and TurnSharp. Both of 'em are for very simple code, if you have components it will generate tons of errors. My project is large, about 1GB counting all the vcl, source and repository. Is there such a tool to do this kind 开发者_C百科of heavy converting? Thanks.
I am afraid there isn't any reliable automated tool to achieve such thing. The differences between Delphi and .NET are huge. I did similar conversion at 2002 and I did it manually, by rewriting the whole project from scratch and it was hardcore stuff. Obviously if you think that porting it to .NET would be too much of a work you could always reuse functionality by exposing it as COM objects.
Stop right now. I did the conversion of about 70,000 lines of code, all non-visual class library stuff, and I estimate it took 3 months to get it working properly, i.e. compiling assemblies using the Delphi 2007.NET compiler and using them in Visual Studio 2010 projects. For my purposes this was important as it gave me a cross-platform distributed application framework, but the effort nearly killed me!
This may be a naive suggestion, but have you considered converting to Delphi Prism (a .NET language based on Delphi syntax)?
It still won't be an easy task, but some VCL components (such as those from DevExpress) have .NET counterparts.
There's no point at all to doing such a conversion. It will take years (there is no tool that will do this for you at the level of complexity you need) and the result will be a buggier version of what you currently have. A C# app will run in all the same operating systems your current app runs in, and have all the same features. (Actually some may drop off, since native code can do several things .net code can not.)
In addition, you will not be able to find the programmers you need in order to handle the conversion, since it would require developers with expert skills in both Delphi and C#. If you thought it was hard to find Delphi developers just wait until you try to find Delphi developers that are also experts in C# and ARE WILLING to work on such a conversion. They are harder to find than a black unicorn.
If you are going to have a visual interface, using WPF, then you use hwndhost to host existing Delphi frames. We are just starting to do this for real, and saves us rewriting the whole codebase in one go. Have a look at http://msdn.microsoft.com/en-us/library/aa970061.aspx for mote information.
We have tried this with our D7 Application, or actually we intended to do this and ended giving up during the analysis phase, as we could'nt find and suitable tool to do this with without having to fix lots of bugs and errors behind it.
I would advice you to consider having a new IDE (If you have an old one) and if you really have to do this. Anyway check this similar question and read the experience of people who had this issue, its not really encouraging.
It is unlikely that your project has the level of unit and integration tests needed to make this less than a very expensive and difficult project. When using automated conversions, it is difficult to achive the architectural changes you need to make the code idiomatic modern c#.
精彩评论