Migrating an Application from .NET Core 3.1 to .NET 5

In this article, we will migrate a WEB API application from .NET Core 3.1 to .NET 5.0.


For this migration, I will be using Visual Studio. The first step it’s necessary to do is:

  • download the Visual Studio 2019 16.8 or later, with the ASP.NET and web development workload. Visual Studio 2019 can be downloaded here.
  • Download .NET 5.0 SDK or later, which can be downloaded here.

For this example, I’m using a project that can be found on my GitHub at this repository: https://github.com/henriquesd/MigratingFromDotNet3.1To5.0

Open the solution with Visual Studio, right-click on the project, click on “Properties”, and on “Target Framework” change from “.NET 3.1” to “.NET 5”:

Do the same for the other project’s layers, including the unit tests projects.

To migrate the Entity Framework Core 3.1 to EF Core 5 and the other packages, right-click on the project and click on “Manage NuGet Packages…”:

Select the package that you want to update, and select the latest version, and click in “Update” (in this example, there are five packages to update, so it’s necessary to do it one by one):

Do the same for the other layers, and also update the packages from the unit test projects. After that, rebuild the application.

You can also double click on the project’s name, to see the .csproj file:

Now let’s run the unit tests:

The unit tests are succeeding.

This is a demo project, so I deleted the database and created it again with the command “update-database”:

The database was successfully created:

Not let’s run the application:

I executed some operations to test it, and as we can see, everything it’s working well:

A category was successfully added. Now let’s execute the GET operation:

The category was successfully returned.


Migrating a project from .NET Core 3.1 to .NET 5 it’s simple and easy, as we just saw in this example, no issues happened and everything works well after the migration. You can check the code of this example on my GitHub:


Thanks for reading!

.NET Full-Stack Developer | C# | .NET | .NET CORE | ASP.NET MVC | Unit Test | Angular