Pages

Sunday, May 22, 2016

VB.Net Windows Project to C# Conversion Tools Quick Review

If you’re looking for a thorough comparative review, this isn’t it! But, here are a few tools I looked at for converting a complex VB.NET project to C#.

Convert.NET by fish’s dotNET

  • Cannot be used commercially with buying the (reasonably priced) license.
  • Stand-alone, but can be added as Tool.
  • Other features besides converting.
  • Conversion of project had the most problems of any tool.

SharpDevelop

  • Only 4.4 can convert from VB to C#. Feature does not exist in version 5.
  • Project isn’t very active, because free versions of Visual Studio are much more readily available.
  • Conversion fidelity will work better with .NET 4.5 or older.
  • Better conversion that Convert.NET
  • Free for commercial use.

VBConversions

Instant C#

  • Commercial tool, expensive $159. (But worth it for a paid contract.)
  • Claims near-perfect fidelity.
  • Has free edition for smaller projects, 2000 line project conversion limit.

My choice: VBConversions, because of the better post conversion tools that show where errors are. However, one thing Instant C# did that I like is automatically generate a variable copy when a VB.NET for…each manipulated the iterating variable.

foreach (string field in fields)
{
   string fieldCopy = field;
   fieldCopy = fieldCopy.Trim();
   ...
}

VBConversions marked it with an error, essentially leaving the code with a bug. If I weren’t to check the errors, this could be a problem because the code would still compile.

foreach (string field in fields)
{
   // field = field.Trim(); VBConversions Warning: A foreach variable can't be assigned to in C#.
   string fieldType = "";
   ...
}

In both cases, it would be wise to set up Visual Studio to treat their comments as Tasks, assuming they consistently start with “VBConversions” or  “INSTANT C#”. Then, go through each comment and remove it after evaluation.

Regardless of the tool, professional diligence says to review every error/message the conversion reports.

References

Get rid of the ‘Missing XML comment for publicly visible type or member’ warning