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.

Prerequisites

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.

Conclusion

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:

https://github.com/henriquesd/MigratingFromDotNet3.1To5.0

Thanks for reading!

--

--

--

.NET Full-Stack Developer | .NET Core | .NET | C# | Azure | Azure DevOps | Microservices | CQRS | Unit Test | Angular | Vue.js

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Where Can I Get a Tool to Categorize Websites?

My Musketeers for DotNet Test driven development

Mongoose, Schemas, Models

5 Questions for MyQ’s Founders: The Programmer, Jakub Ahmadyar

Variables

Express yourself in Ruby on Rails!

3 Fastest Ways to Improve as a Hackathon Judge

The Grind: Tech & Coding Weekly — Issue #11

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Henrique Siebert Domareski

Henrique Siebert Domareski

.NET Full-Stack Developer | .NET Core | .NET | C# | Azure | Azure DevOps | Microservices | CQRS | Unit Test | Angular | Vue.js

More from Medium

Add MVC Controller With Views using Entity Framework in NET 6

Uploading Large Size Files By Using Azure Blob Storage

Migrating From ASP .NET To .NET Core

Custom Driver Command Executor

Selenium Logo with C# Logo