<p>I maintain an old PC-only application written in Delphi 7. Although Delphi has served me very well in the past I now only use it for this one application and find my skills with the language diminishing. Its syntax is too different from my 'day job' languages of Java/Ruby so it takes me longer to get into the groove of writing new code, plus it is so old I have not used many <strong>interface</strong>s so the code is not managed which seems ancient to me now!</p>

<p>Many of my users are moving to Vista which may run the app in compatibility mode or may have GPF problems depending on how their PC is configured by their IT department, so I have to do some maintenance on the application.  I'm wondering if I should jump to a more familiar stack.</p>

<p>Is there an automated tool that will do the legwork of converting the code base to C#, leaving me to concentrate on the conversion on any non-standard components?  I'm using an embedded database component called <a href="http://www.componentace.com/bde_replacement_database_delphi_absolute_database.htm" rel="noreferrer">AbsoluteDatabase</a> which is BDE compatible and using standard SQL throughout, and a native Delphi HTML browser component which can be swapped out with something from the Microsoft world.</p>

<p>How good are these conversion tools?</p>

[{'answer_id': 59600, 'author': 'Jim McKeeth', 'author_id': 255, 'author_profile': 'https://Stackoverflow.com/users/255', 'pm_score': 5, 'selected': True, 'text': '<p>I am not aware of any automated tools for making that conversion.  Personally I would suggest you stick with Delphi, maybe just upgrade to a new version.  I have seen a couple code DOM\'s that attempt to convert from Delphi to C#, but that doesn\'t address the library issue.  </p>\n\n<p>CodeGear (formally Borland) has a tool for <a href="http://dn.codegear.com/article/32338" rel="noreferrer">going from C# to Delphi</a> that works OK.  I would assume the tools that go the other direction will work the same (requiring a lot of editing).  Here is a Swedish tool that works on the same CodeDOM principle to go from <a href="http://w1.311.telia.com/~u31115556/desc/programs.htm#BabbelFisken" rel="noreferrer">Delphi to C#</a> (and a number of other languages).  There are others, I just can\'t find them right now.</p>\n\n<p>Another option would be to upgrade to a more resent version of Delphi for .NET and port your code to .NET that way.  Once you get it working in Delphi for .NET (which will be pretty easy, except for the embedded DB, unless they have a .NET version) you can use <a href="http://www.red-gate.com/products/reflector/" rel="noreferrer">.NET Reflector</a> and <a href="http://www.denisbauer.com/NETTools/FileDisassembler.aspx" rel="noreferrer">File Disassembler</a> reverse the IL to C#.  You will still be using the VCL, but you can use C# instead of Object pascal.</p>\n\n<p>Another similar solution would be to port it to <a href="http://remobjects.com/oxygene" rel="noreferrer">Oxygene by RemObjects</a>.  I believe they have a Delphi Win32 migration path to WinForms.  Then use <a href="http://www.red-gate.com/products/reflector/" rel="noreferrer">.NET Reflector</a> and <a href="http://www.denisbauer.com/NETTools/FileDisassembler.aspx" rel="noreferrer">File Disassembler</a> reverse the IL to C#.  </p>\n\n<p>In short, no easy answers.  Language migration is easier then library migration.  A lot of it depends on what 3rd party components you used (beyond AbsoluteDatabase) and if you made any Windows API calls directly in your application.</p>\n\n<p>Another completely different option would be too look for an off shore team to maintain the application.  They can probably do so cheaply.  You could find someone domestically, but it would cost you more no doubt (although with the sagging dollar and poor job market you never know . . . )</p>\n\n<p>Good luck!</p>\n'}, {'answer_id': 62030, 'author': 'dcraggs', 'author_id': 4382, 'author_profile': 'https://Stackoverflow.com/users/4382', 'pm_score': 2, 'selected': False, 'text': "<blockquote>\n  <p>Many of my users are moving to Vista\n  which may run the app in compatibility\n  mode or may have GPF problems\n  depending on how their PC is\n  configured by their IT department, so\n  I have to do some maintenance on the\n  application. I'm wondering if I should\n  jump to a more familiar stack.</p>\n</blockquote>\n\n<p>Unless you are doing something non standard, D7 applications should run fine in Vista.</p>\n\n<p>As for conversion to C#, I would think that most conversion tools would be a waste of time. A better approach may be to rewrite the application from scratch.</p>\n"}, {'answer_id': 62046, 'author': 'Anthony', 'author_id': 5599, 'author_profile': 'https://Stackoverflow.com/users/5599', 'pm_score': 2, 'selected': False, 'text': "<p>There is no easy answer, but bear in mind that the Delphi.net variant of the language targets the .net runtime, and that different languages on .net can interoperate closely.</p>\n\n<p>You could try getting it to compile in Delphi.Net, factoring into different assemblies and then converting the assemblies by hand one by one. Reflector could help be reverse-engineering compiled code into a skeleton of C# code - equivalent but without comments, internal variable names etc.</p>\n\n<p>On the other hand, Delphi.net may be good enough (TM) for this project.</p>\n\n<p>But unless you have a good test suite (I'm guessing probably not, given the state of the art in Delphi 7) you're going to introduce bugs.</p>\n"}, {'answer_id': 19595690, 'author': 'Stephan Eggermont', 'author_id': 35306, 'author_profile': 'https://Stackoverflow.com/users/35306', 'pm_score': 3, 'selected': False, 'text': '<p>There has been a scientific report of a successfull transformation of a 1.5 million line Delphi Project to C# by John Brant. He wrote a Delphi parser, a C# generator and lots of transformation rules on the AST. Gradually extending the set of rules, doing a daily build, lots of unit tests, and some rewriting of difficult Delphi parts allowed him with a team of 4, among which some of the original developers, with deep Delphi &amp; C# knowledge, to migrate the software in 18 months. John Brant being the original developer of the refactoring browser and the SmaCC compiler construction kit, you are unlikely to be able to go that fast</p>\n'}]
['https://Stackoverflow.com/questions/59547', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3366/']