Home

Awesome

Code Converter

Build CodeConverter Install

Convert code from VB.NET to C# (and vice versa) using Roslyn - all free and open source:

See wiki for advice on getting the best results, or the changelog for recent improvements.

Visual Studio Extension

Adds context menu items to convert projects/files between VB.NET and C#. See the wiki documentation for advice / help using it.

Download from Visual Studio Marketplace (Use VS 2022 17.1+)

<p> <img title="Selected text can be converted" alt="Selected text conversion context menu" src="https://github.com/icsharpcode/CodeConverter/raw/master/.github/img/vbToCsSelection.png" /> </p>

Contributing

Let us know what needs improving. If you want to get involved in writing the code yourself, even better! We've already had code contributions from several first time GitHub contributors, so don't be shy! See Contributing.md for more info.

The VB -> C# conversion quality is much higher than the C# -> VB conversion quality. The use cases differ considerably as does the supply/demand of improvements.

Use cases

Visual Basic .NET is slowly dying. It has support for some project types on .NET 5, but won't be getting new features according to the .NET Team Blog. Hence the main use case for:

Other ways to use the converter

Building/running from source

  1. Ensure you have .NET Core SDK 6.0
  2. Open the solution in Visual Studio 2022+ (Community edition is sufficient)
  3. To run the website, set CodeConverter.Web as the startup project
  1. To run the Visual Studio extension, set Vsix as the startup project
    • A new instance of Visual Studio will open with the extension installed

History

A spiritual successor of the code conversion within SharpDevelop and later part of Refactoring Essentials, the code converter was separated out to avoid difficulties with different Visual Studio and Roslyn versions.

More screenshots

<p float="left"> <img src="https://github.com/icsharpcode/CodeConverter/raw/master/.github/img/solution.png" width="49%" /> <img src="https://github.com/icsharpcode/CodeConverter/raw/master/.github/img/vbToCsFile.png" width="49%" /> <img src="https://github.com/icsharpcode/CodeConverter/raw/master/.github/img/vbToCsProject.png" width="49%" /> <img src="https://github.com/icsharpcode/CodeConverter/raw/master/.github/img/csToVbProject.png" width="49%" /> </p>