Microsoft has moved closer towards bringing Visual Basic into place as a first-class citizen on the .NET Core platform. As part of the .NET Core 2 release, VB developers can now write console apps and class libraries that target .NET Standard 2.0-- and all are multiplatform compatible. This means the same executable or library that runs on Windows can work on macOS and Linux.
Once the .NET Core 2 SDK is installed, you will have the ability to start creating VB projects. Since this is .NET Core, Visual Studio is helpful but not required. Four VB templates within 2.0:
- Console Application - sample Hello World app
- Class Library
- Unit Test Project
- xUnit Test Project
From a command prompt, you can run:
dotnet –version
to confirm that you are on .NET Core 2.0 or greater. Then create a new directory to hold your new project, and run dotnet new to create a new project based on one of the templates. Then run dotnet run to launch the project:
mkdir vbcore
cd vbcore
dotnet new console -lang VB
dotnet run
This doesn't mean that Microsoft's work is done however, as work remains for VB developers on .NET Core to gain the ability to use ASP.NET Core. Templates for that are in the works per Microsoft’s Immo Landwerth but are not available with this release. However, VB developers can now write cross-platform code for macOS and Linux, something that was not possible in a supported manner until now.