Back to Aspnetcore

Migrate from ASP.NET Core in .NET 9 to ASP.NET Core in .NET 10

aspnetcore/migration/90-to-100.md

latest2.6 KB
Original Source

Migrate from ASP.NET Core in .NET 9 to ASP.NET Core in .NET 10

<!-- New content should be added to the includes files in the '90-to-100' folder. This will help prevent merge conflicts in this file. -->

This article explains how to update an ASP.NET Core in .NET 9 to ASP.NET Core in .NET 10.

Prerequisites

Visual Studio

[!INCLUDE]

Visual Studio Code

[!INCLUDE]


Update the .NET SDK version in global.json

If you rely on a global.json file to target a specific .NET SDK version, update the version property to the .NET 10 SDK version that's installed. For example:

diff
{
  "sdk": {
-    "version": "9.0.304"
+    "version": "10.0.100"
  }
}

Update the target framework

Update the project file's Target Framework Moniker (TFM) to net10.0:

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

  <PropertyGroup>
-    <TargetFramework>net9.0</TargetFramework>
+    <TargetFramework>net10.0</TargetFramework>
  </PropertyGroup>

</Project>

Update package references

In the project file, update each Microsoft.AspNetCore.*, Microsoft.EntityFrameworkCore.*, Microsoft.Extensions.*, and System.Net.Http.Json package reference's Version attribute to 10.0.0 or later. For example:

diff
<ItemGroup>
-   <PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="9.0.0" />
-   <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0" />
-   <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.0" />
-   <PackageReference Include="System.Net.Http.Json" Version="9.0.0" />
+   <PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="10.0.0" />
+   <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.0" />
+   <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="10.0.0" />
+   <PackageReference Include="System.Net.Http.Json" Version="10.0.0" />
</ItemGroup>

Blazor

[!INCLUDE]

Breaking changes

Use the articles in Breaking changes in .NET to find breaking changes that might apply when upgrading an app to a newer version of .NET.