Introduction
.NET 6 is an LTS (Long Term Support) Version. It will be supported for three years. It is the latest long-term support release. The previous version, .NET Core 3.1 support, was finalized in December 2022, and support for .NET 5 already ended in May 2022. This article describes how to upgrade the solution from .NET Core 3.1 to .NET 6.0 with an example of a web application project.
Pre-requisites
- Visual Studio 2022
Step 1. Change the Project Target Framework
Open your current project in Visual Studio 2022. Right-click on the Project name in Solution Explorer and select Properties.

Then select the target framework to .NET 6.0 as shown below and save it.

After this step, the base framework changed. One can check or alternatively change the framework from the project_name.csproj file. The code looks similar to the code depicted below.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>
Step 2. Updating Package references
While migrating from ASP.NET Core 3.1 to .NET 6.0, it is very important to upgrade the NuGet packages used in the current project.
Method 1 for upgrading Package
Using NuGet Package Manager, you can change the package version to a compatible version with .NET 6. Please see the snap below for reference.

Method 2 for upgrading Package
Go to Project.csproj file and upgrade packages as shown below. For instance, upgrade the Microsoft package.AspNetCore.JsonPatch and Microsoft.EntityFrameworkCore.Tools and so on from version 3.1.6 to 6.0.0, as illustrated below.
<ItemGroup>
- <PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="3.1.6" />
- <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.6" />
- <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="3.1.6" />
- <PackageReference Include="System.Net.Http.Json" Version="3.2.1" />
+ <PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="6.0.0" />
+ <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0" />
+ <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="6.0.0" />
+ <PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
</ItemGroup>
Join the conversation! Your thoughts help the community grow.