from ASP.NET How to migrate core 3.1 to 5.0

Time:2020-9-2

In mid March, Microsoft officially released the first preview version of dotnet 5: 5.0.0-preview. 1.

After the development and precipitation of previous versions, dotnet core has been basically stable in 3.1.

So upgrading from. Net core 3.1 to. Net 5 will be very simple. Let’s get started

(Note: Visual Studio 2019 16.6 or higher is required)

Step 1: in global.json Update. Net core SDK version in


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

Step 2: update the target framework


<Project Sdk="Microsoft.NET.Sdk.Web">
 <PropertyGroup>
  <TargetFramework>netcoreapp5.0</TargetFramework>
 </PropertyGroup>
</Project>

Step 3: update package references

In the project file, set each Microsoft.AspNetCore . * and Microsoft.Extensions . * the version property of the package reference is updated to 5.0.0 or later.

For example:


<ItemGroup>
  <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.0-preview.1.20124.5" />
  <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="5.0.0-preview.1.20120.4" />
</ItemGroup>

Step 4: update docker image

For applications that use docker, use the ASP.NET Basic image of core 5.0. For example:


docker pull mcr.microsoft.com/dotnet/core/aspnet:5.0

Yes, it’s so simple that you can easily upgrade dotne core 3.1 to dotnet 5 with the above four steps

Major changes from version 3.1 to version 5.0

What are the major changes from dotnet core 3.1 to the first preview of dotnet 5?

In fact, there are not many, mainly focusing on the following points:

1. Azure: azure integration package with Microsoft prefix removed

2. Signalr: the message pack hub protocol has been moved to the message Pack 2. X package

3. Signalr: usesignalr and useconnections methods have been deleted

summary

From the above description, it can be found that there is not much change from 3.1 to 5.

The biggest change, I wonder if you found a “core” missing from dotnet core 3.1 to dotnet 5.

Yes, the more important significance from 3.1 to 5 is to mark the arrival of a new era of dotnet.

Let’s look forward to the official release of dotnet 5 by the end of this year.

This is about ASP.NET This is described in the article on the migration of core 3.1 to 5.0 ASP.NET Core 3.1 to 5.0 content, please search the previous articles of developeppaer or continue to browse the related articles below. I hope you can support developeppaer more in the future!

Recommended Today

Computer basic summary of 2021 autumn recruitment interview – operating system

A series of articles: 2021 autumn recruitment interview computer foundation summary – algorithm, data structure, design pattern, Linux Computer foundation summary of 2021 autumn recruitment interview – Java foundation, JVM, spring framework Computer foundation summary of 2021 autumn recruitment interview database, redis Computer basic summary of 2021 autumn recruitment interview – operating system Computer foundation […]