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. If the solution contains more than one .vbproj or .csproj, the context menu will also provide the option to convert all projects to Elements in one go. This path has the benefit that it can adjust all project references between the projects to point to the converted .elements projects, as well.

  • 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.
  • Dropping unnecessary .Designer.vb files

and more.

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

Project References

When converting projects that are part of a larger solution, Fire and Water will automatically try to adjust Project References as well, with some limitations:

  • If you choose to "Convert all projects to Elements" in one go, the IDe will be avle to adjust all (well-formed) project references to the converted projects to the new filenames.

  • If you convert a single project to Elements, the IDE will adjust project references to it in existing Elements projects, but it will not touch any not-yet-converted .vbproj (or .csproj) projects.

Therefore, the best option for converting a solution with several inter-dependent projects would be to convert all projects in one go.

See Also