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:
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.
After that, absolutely everything worked perfectly. No issues in Entity Framework, native JSON libraries, Startup.cs configurations.