ASP.NET Core 5.0 - Migrate From .NET Core 3.1

Ken Haggerty
Created 12/02/2020 - Updated 12/02/2020 03:50

This article will describe how to migrate an ASP.NET Core 3.1 Razor Pages project to .NET 5.0. I will assume you have an existing or created a new ASP.NET Core 3.1 Razor Pages project. See Tutorial: Get started with Razor Pages in ASP.NET Core.

I have migrated KenHaggerty.Com to ASP.NET Core 5.0. I have published ASP.NET Core 5.0 research projects which originated with ASP.NET Core 3.1. I have tested the migration all of the ASP.NET Core 3.1 research projects and have found no issues. The demo.kenhaggerty.com site which implements the ASP.NET Core 3.1 - Users Without Identity Project and the published version of the ASP.NET Core 3.1 - Bootstrap Native Project at preview.kenhaggerty.com have been migrated.

.NET Core releases alternate between LTS and Current releases, so it is possible for an “LTS” release that shipped first (for example .NET Core 3.1) to be supported for longer than a “Current” release (for example .NET 5) that shipped later. Credit: NET Core Releases and Support

Because the ASP.NET Core 3.1 research projects are easy to migrate and will be supported longer than .NET 5, I have decided against offering .NET 5 versions for existing ASP.NET Core 3.1 research projects. Before you migrate you should review Breaking changes in .NET 5.0 for any issues which may affect your project. I will use the ASP.NET Core 3.1 - Users Without Identity Project for screenshots but the process is similar for the other research projects.

First update the Target Framework. You can update the Target Framework on the project's properties page from .NET Core 3.1 to .Net 5.0.

Project Properties
Update Target Framework

Or you can edit the project file (PROJECTNAME.csproj). Update the TargetFramework property from netcoreapp3.1 to net5.0.

Edit Project File
Edit Target Framework

Next update NuGet packages. Select all packages on the Nuget page's Updates tab and update.

Manage NuGet Packages
Update All Packages

There is an update for SignalR if you implement SignalR like KenHaggerty.Com. See Introduction to ASP.NET Core SignalR

Edit libman.json:
{
"destination": "wwwroot/lib/signalr",
"files": [
"dist/browser/signalr.js",
"dist/browser/signalr.js.map",
"dist/browser/signalr.min.js",
"dist/browser/signalr.min.js.map"
],
"library": "@@microsoft/signalr@5.0.0",
"provider": "unpkg"
}

Build, run and test.

Comment Count = 0

Please log in to comment.

Login Register
Logged in users receive web notifications.
Web Notifications