8

Can anyone recommend a good application that could be used to convert VB.NET projects to C#, without having to do too much manual work?

We've used Reflector to do small libraries manually, but some of the larger projects will be too slow and complex to do this manually.

8 Answers 8

10

You can use Lutz Roeders Reflector (http://www.red-gate.com/products/reflector) which can decompile whole Assemblies into Visual Studio projects. This way you can convert from ANY .NET Langauge into one of the supported languages of this program (C#.VB.NET,MC++,Delphi,Chrome)

1
  • Of course, be wary of any EULAs that you might violate this way.
    – Jon Limjap
    Apr 8, 2009 at 10:16
7

Tangible Software do various converters, including VB to C#.

I've played with it a little bit as they're kind enough to give me a copy for free, but I can't say I've stress-tested it. When I've used it it's been fine though - certainly worth a try.

0
6

A few things to keep in mind...

1) Depending on how the VB.Net code was written, automatic conversion may or may not be 100% possible. VB.Net allows a "looser" coding style that would be ambiguous to C#. So, some manual intervention may be needed.

2) If the VB.Net code functions correctly, you may want to just leave it as VB.Net. Both VB.Net and C# projects can co-exist within the same solution.

0
4

The far best tool for this is Econ Netvert which can be found on CodePlex http://www.codeplex.com/econnetvert

0
3

SharpDevelop has this feature, but I haven't used it enough to know if works reliably. It seems to be a pretty good otherwise, so it's worth a try though.

1
  • SharpDevelop does an excellent job, for the most part. One area I have found problematic is the amount of automatic type coercion going on in a lot of the VB.Net code I work on. That and array accessors are the same syntax as method calls. Code that is heavy on use of DataRow, for instance, needs to be changed to use DataSetExtensions and DataRow.Field<type>(), DataRow.SetField() respectively.
    – dwerner
    Jan 20, 2013 at 0:59
3

The best and fast converter I have seen so far is http://converter.telerik.com/

Nicely presented using RAD AJAX Controls.

Note: It converts only code snippets and not projects as a whole.

0
1

There's also the free online converters up at developerfusion :)

1

SharpDevelop is quite good, but at my company we've found VBConversions to provide a much more complete conversion. It's a commerical app though, but for the time saved over SharpDevelop it was a no-brainer for us.

As a specific example, one thing we found that SharpDevelop didn't convert correctly was VB indexes, which use curvy brackets. It seemed unable to distinguish between indexes and method calls so didn't convert the indexes to square brackets. VBConversions converted them fine. This one thing made it worth its purchase for us.

It looks like the Tangible Software product works very similarly to VBConversions.

Not the answer you're looking for? Browse other questions tagged or ask your own question.