Now we have .NET 6 Preview 2 and a road to the next LTS

Posted: (EET/GMT+2)

 

Microsoft has released .NET 6 Preview 2, giving developers another early look at the next Long-Term Support (LTS) release of .NET.

.NET 6 is important because it follows .NET Core 3.1 as the next LTS release. For teams running production workloads on .NET Core 3.1, this is the release cycle worth getting on to.

After installing the preview SDK, check the installed versions:

dotnet --list-sdks

Then, create a small test project:

dotnet new console -n Net6PreviewTest
cd Net6PreviewTest
dotnet run

If the project needs to target .NET 6 explicitly, check the project file:

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

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

</Project>

As with all previews, you should keep preview SDKs out of production build agents unless you are testing the upgrade intentionally. For test repositories, pin the SDK with global.json:

dotnet new globaljson

Then update the SDK version to match the preview installed on the machine:

{
  "sdk": {
    "version": "6.0.100-preview.2"
  }
}

The practical work at this stage is not rewriting applications. It is checking whether the current solution builds, whether dependencies restore, and whether tests still pass.

Good candidates for early testing:

  • shared libraries
  • build pipelines
  • ASP.NET Core applications
  • NuGet packages
  • internal developer tools.

If the upgrade fails, write down the first blocking package or build step. That gives you a migration checklist before the final release arrives.

Go .NET!