Upgrading your web project from ASP.NET Core 2.0 to ASP .NET Core 2.1
ASP.NET Core 2.1 was released on May 30, 2018. Various new features were released and some major performance enhancements were done in this release.
Here are some of highlights:
- SignalR — A new stable version was released which doesn’t depends on jQuery
- HTTPS — by default
- Identity as a library
- Razor class libraries — views as a reusable component
- GDPR related templates
- Entity framework enhancements and lots more you can check more details here.
I will walk through steps require to migrate your existing ASP.NET Core 2.0 project to ASP .NET Core 2.1
- Install .NET Core 2.1 SDK from here. Install this SDK in your machine and also in server where site will be hosted.
In screenshots given below left side of image is ASP.NET Core 2.0 codes and on the right side is ASP.NET Core 2.1 codes. Red highlighted indicates codes are removed and green highlight indicates addition.
2. Open Program file and make changes as given in screenshot below.
3. Now open your project .csproj file in notepad or any text editor. Make following changes:
- Change target framework version to 2.1.
- Upgrade packages to 2.1 version.
- Remove cli tools as those are in built in ASP.NET Core
- Remove Entity framework as those are included in ASP.Net core App packages.
You can find changes in below screenshot. Similarly upgrade version for libraries in other projects in your solution. You can also head over to Nugget package manager and update packages.
4. Finally, make following changes in Startup file:
- Remove browser link code as it is not available.
- Use HTTPS and HSTS
Your project is now upgraded to ASP.NET Core 2.1
To know more about migration you can refer Microsoft migration guide.