In this article, we will understand how to update the .NET Core 2.0 application to 2.1, So, Many of you are developing applications in ASP.NET Core 2.0 version. as that was the most release with lots of more features. but, did you recognize that the next big release has already happened? with some more options in ASP.NET Core journey. Have you already migrated your applications to ASP.NET Core 2.1.x version already? If you haven’t, no worries, here we are going to understand. how we can migrate our applications to the new version of ASP.Net Core.
Let’s we will understand step by step how to update your existing ASP.NET Core application to 2.1.x. Now, We will be creating The ASP.NET Core 2.0 application first. after that, we will update the same to the 2.1.x version.
Create New MVC Application
Let’s create the new.Net Core 2.0 application in Visual Studio, then click on File -> New Project
Here, you can see the ASP.NET Core version 2.0. If you want to check your application version. Then go to your application properties and check the version.
Update .Net Core 2.0 to 2.1.x
The first step is, more getting to work with ASP.NET Core 2.1, before you would like to update your IDE. So, There are some of the ways you’ll update your IDE, but the simplest method is to go check the Notifications panel. Let’s see the way to do this.
Go to the view tab and click on Notifications.
Now, you’ll see all the notifications here as shown within the below image. you need to update your Visual Studio whenever there’s an update. thus you won’t be ready to see that notification here on my panel. If you haven’t updated, and if you check the Notifications panel, you’ll get a link to the update here. you’ll be ready to do more.
Once you get updated, then you can verify the version
Install the latest ASP.NET Core version
Let’s go to following link and then select the latest version for ASP.NET core SDK
After that, you can see that we have installed ASP.Net core SDK and .NET Core runtime and now you can see the following new available versions in visual studio 2017.
Change The Target Framework
Here, we need to change the target framework in our application. so, you need to select it in the properties either you can edit the .csproj file.
The ASP.NET core has all default package dependencies in one library. Let’s change the Microsoft.AspNetCore.All to Microsoft.AspNetCore.App. So, this version reduces the number of dependencies.
Now, change the toggle framework to 2.1 and remove the All part in package reference and replace it with App. so, you no longer need a version part. then remove the package reference of core tools and also update the version of the design to 2.1.0
Here, we can publish our new application. but you’re a few more things to consider before publishing an application. first, go to application properties and pick up the folder as my target and create the profile. after that publish using the publish button.
Let’s go and build the project and you will see the following output
So, I hope you will understand how to update/migrate .NET core to 2.1 version and package dependancies.