Converting from VB.NET to Mercury

Mercury provides the option to easily convert an existing .vbproj (and also .csproj) for use with Elements.

There are three main ways to trigger a conversion:

  • When opening a sln file that contains one or more .vbproj projects in Fire or Water, these projects will show in the project tree, but grayed out as "unsupported". You can right-click an individual project and choose "Convert to Elements" from the context menu. This will convert the project in place, create a new .elmemets file, and replace it in the solution.

  • You can use the "File|Import|Visual C# or Visual Basic.NET Project" menu item in Fire or Water to open and convert a .vbproj directly. This will automatically create a new .elements file based on the original project file. If a .sln with a matching name already exists in the same folder, it will be preserved, and a second Silution will be created for the new project.

  • You can use the EBuild command line tool with the --convert to convert convert projects from the Terminal/Command Line or from a batch script. On Mac, you will need to install the External Compiler to use the command line tool.

All three paths lead to the same conversion logic. The .vbproj will be read and analyzed, and a new .elements project will be created based on its contents. The .vbproj will not be changed.

When converting projects within an open solution, as an added benefit, the IDE will also try to adjust any project references from existing Elements projects to the project being converted.

The conversion performs a number of steps to try and bring most settings and features over. This includes but might extend beyond:

  • Removing legacy and unsupported settings.
  • Adjusting settings that use different names in Elements, such as AllowUnsafeCode, GeneratePDB, VBOptionStrict, etc.
  • Converting Imports to the DefaultUses setting.
  • Setting XmlLiteralMode to "Linq to SQL" (see here).
  • Migrating DEBUG, TRACE, CONFIG= and _MYTYPE= Conditional defines.

and more.

Please let us know if you encounter any problems converting projects, of have suggestions for more derails that should be carried over.