Trying .NET 5 Preview on a developer machine

Posted: (EET/GMT+2)

 

Microsoft has released .NET 5 Preview 5, giving developers another early build of the next major .NET release to test.

The soon-here .NET version 5 is the next step after .NET Core 3.1 and is planned as the release that continues the unification of the modern .NET platform.

For a developer machine, the preview SDK can be installed side-by-side with existing .NET Core SDKs.

After installing the preview SDK, check the installed versions:

dotnet --list-sdks

Create a small test project:

dotnet new console -n Net5PreviewTest
cd Net5PreviewTest

Then update the project file to target net5.0:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

</Project>

Run the application:

dotnet run

Tip: keep preview SDK usage explicit. If you have multiple SDK versions installed, use a global.json (see here) file in test repositories so the intended SDK version is clear.

dotnet new globaljson

Then edit the file to match the preview SDK version installed on the machine:

{
  "sdk": {
    "version": "5.0.100-preview.5"
  }
}

Preview releases are useful for checking package compatibility, build scripts, analyzers, CI pipelines, and framework changes before the final release.

They should not be used as a production baseline unless Microsoft specifically documents support for that build.

Make sure you test the preview with a small branch or sample application first. Avoid upgrading the main production project file just to experiment.