Migrating from .NET Core 6 to .NET Core 7 Print

  • .net core 6 to .net 7, .net core
  • 0

  1. Update the .NET Core SDK version in global.json to 7.0.100, or the version that's installed on your system. Example:
{ "sdk": { "version": "7.0.100" } }
  1. Update the project file's Target Framework Moniker (TFM) to net7.0: Example:
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>net7.0</TargetFramework> </PropertyGroup> </Project>
  1. Update each package reference's Version attribute to 7.0.0 or later for the following packages: Microsoft.AspNetCore., Microsoft.EntityFrameworkCore., Microsoft.Extensions.*, and System.Net.Http.Json. Example:
<ItemGroup> <PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="7.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0"> <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="7.0.0" /> <PackageReference Include="System.Net.Http.Json" Version="7.0.0" /> </ItemGroup>
  1. For Blazor apps, create a new 7.0 Blazor project from one of the templates and move the app's components and code to the 7.0 app, making modifications to adopt the new 7.0 features. Unmarshalled interop using the IJSUnmarshalledRuntime interface is obsolete and should be replaced with JavaScript [JSImport]/[JSExport] interop. Also, Blazor WebAssembly authentication uses navigation history state for redirects.

  2. Update Docker images in your Dockerfile FROM statements and scripts. Use a base image that includes the ASP.NET Core 7.0 runtime, for example: docker pull mcr.microsoft.com/dotnet/aspnet:7.0.

  3. Review the breaking changes from .NET Core 6.0 to .NET 7.0, which are listed in the Breaking changes in .NET 7 document. This includes changes to authentication in web assembly applications, Blazor routing and navigation, and secure ASP.NET Core Blazor WebAssembly.

That's it! Following these steps should help you successfully migrate your .NET Core 6.0 app to .NET Core 7.0.


Was this answer helpful?

« Back