Migration From Asp.Net Core 3.1 to 5.0— Real Project

Alexandre Malavasi
The Startup
Published in
4 min readNov 12, 2020

The purpose of this article is to share my personal experience of migrating a medium complexity real project from Asp.Net Core 3.1 and Asp.Net Core 5.0.

The project uses the following stack:

  • Asp.Net Core Web API
  • Vue JS front-end without any Razor Pages used in the project. The entire front-end is a Vue JS application
  • Entity Framework Core (Code First approach)
  • SQL Server Database

At the beginning of my career, almost all the time I decided to postpone the upgrade of .NET projects under my responsibility to the newest version of the underlying technology. There are many factors that should be considered before migrating a system: costs, effort, complexity, business value, etc. Therefore, depends on the scenario, many projects aren’t migrated to a newer version.

I changed my mind in the last years, mainly after the launch of the first version of .NET Core. The first migrations from .NET Framework to .NET Core might be problematic for complex projects, but the migrations between .NET Core versions and to .NET 5 should not be that hard.

In the rest of the article, I’m going to demonstrate all the steps I made to migrate a real project, all the problems, and, of course, the solutions I’ve found and applied.

Visual Studio Update

The very first thing I did is to update Visual Studio 2019 to the latest version once the .NET 5.0 was officially launched yesterday (November, 11th).

Usually, the update installs the newest .NET SDK as well. But, in case it is not, you need to install the .NET 5.0 SDK:

https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-5.0.100-windows-x64-installer

Framework version change

Change the Target Framework to .NET 5.0:

In order to make in how many issues you could have after this step is recommended rebuild the application and see how many issues will appear in compile time. In my case, no problems so far:

Project file (.csproj)

The next step is to update the version of any package that has the target to .NET Core 3.1 version:

Nuget package updates

Logically, the next step was to upgrade the rest of the packages used by the application to the newest possible version. In that context, I was using just third party libraries for Vue JS Middleware and native libraries of .NET Core. But, it might be different in your scenario. So, it is really important to analyze it before your own migration.

Conclusion

After that, absolutely everything worked perfectly. No issues in Entity Framework, native JSON libraries, Startup.cs configurations. It was much easier than the migration from .NET 2.2 to .3.1, which difficulties you can see in the article below that I made using the same project:

https://medium.com/@alexandre.malavasi/migration-from-asp-net-core-2-2-to-3-1-real-project-ca382ea7eef7

Of course, your scenario could be different from mine, but generally, the migration should not be so hard if you are using .NET 3.1 already.

In case you want to get information on any break changes in this version, please take a look at the link below:

https://docs.microsoft.com/en-us/dotnet/core/compatibility/3.1-5.0??WT.mc_id=DOP-MVP-5003776

https://docs.microsoft.com/en-us/aspnet/core/migration/31-to-50?WT.mc_id=DOP-MVP-5003776&view=aspnetcore-5.0&tabs=visual-studio

In case of any questions, please feel free to leave it here or in any of my social profiles.

Thank you for reading this article till the end. The following are my social media profiles where I frequently share my technical posts and information on IT Events.

Twitter: https://twitter.com/alemalavasi
Linkedin: https://www.linkedin.com/in/alexandremalavasi/
Youtube: https://www.youtube.com/channel/UC-KFGgYiot1eA8QFqIgLmqA
Facebook: https://www.facebook.com/alexandre.malavasi.dev

--

--

Alexandre Malavasi
The Startup

Microsoft MVP | MCP | MCTS | MCPD | ITIL | .NET | MBA | MTAC | Technical Leader | Consultant | .NET Developer