DEV Community

Rahul Mathur
Rahul Mathur

Posted on • Updated on

Upgrade your existing ASP.NET Core 1.1 applications to ASP.NET Core 2

Microsoft recently released ASP.NET Core 2 of their open source along with cross platform frameworks as well as libraries. It is quite an exciting release and it is a step towards the framework’s stabilization and enabling the developers as well as businesses to start looking at using the ASP.NET 2.0. It is why it opens new avenues for dot net development services. Let’s go through how you can upgrade the existing ASP.NET Core 1.1 applications to the ASP.NET Core 2.

Installation of ASP.NET Core 2.0
The very first step that you have to do is to install the new 2.0 SDL and in case you are using Visual Studio as your choice of IDE then you have to install the most recent version of Visual Studio 15.3.x to work with the new ASP.NET Core 2.0. These steps are very easy as well as well documented.

Upgradation of the MVC Project
When you have loaded the already web solution in the Visual Studio, then your first task is to upgrade the web project and then get it running. Therefore, unload the test project so that you don’t get distracted by errors from that.

Upgradation of Project Files as well as Dependencies
Now the next thing to do is to upgrade your project to target ASP.NET Core 2.0 and to upgrade the related dependencies to request the .NET Core 2.0 packages. Click the project and then chose to edit the file named cs proj directly. With the .NET Core projects, you can do this easily without any requirement of unloading the first. Also, the .NET Core projects have a node named target Framework which is needed to set to net core app 1.0. To upgrade the target the recent Target Framework Moniker or the TFM for Core 2.0, just simply change it to norecoreapp2.0.

The project is also included into a runtime Framework Version property set to particular 1.0.4 that is removed to ensure such that the project can use the most recent available runtime. The migration guide also makes it sure and specifies that the Package Target Fallback node as well as the variable should also be renamed to Asset Target Fallback and this is needed to be done. This is an important aspect of asp dot net development.
Changes of Identity and Authentication
In case of ASP.NET Core 2.0, some of the most significant changes are made in the Identity namespace. Microsoft has adjusted certain things when it comes to Identity models as well as authentication. These changes previously required some fixes as well as restructuring in the code to comply with the latest new model. Microsoft has put together a certain specific migration document that is worth reviewing in case you have to migrate the Identity code.

One of the major changes are also made with the Identity in case of ASP.NET Core 2.0 which s the third party login providers which are now configured whenever there is registration of Authentication services and they are no longer need to be added as a particular individual middleware component.

Related- KNOW WHY ASP DOT NET WILL CONTINUE TO RULE BUSINESS TECHNOLOGY

To account for this particular change, update the Configure Services method to use the latest Add Authentication extension method on IService Collection. It also includes various extension methods on the particularly returned Authentication Builder that can be used to add as well as configure the given additional authentication providers. You need to conditionally register the providers only in case if the application configuration consists of the required Client ID or APP for each of the provider. It is doe with different optional calls made to the Add Authentication method.

Important Migration Changes
There are few structural changes that can be and should be made to the existing ASP.NET Core 1.0 project in order to take the full advantage of conventions of ASP.NET Core 2.0. the first things is to update the program.cs to use the latest Create Default Builder functionality. This particular method is specifically designed to simplify the ASP.NET Core Web Host set up by means of defining some of the common defaults that you have previously had to set up in the Startup class manually. It adds in the Kestrel as well as IIS Integration for instance. The IWeb Host in the .NET Core 2.0 also sets up the logging and configuration and also registering them with the DI earlier in the lifecycle of the application.

Conclusion

For the most significant part of the migration documentation which is provided by the Microsoft are very good and has covered a lot of things. There are few cases where you can find little extra things that you need to solve. For the most part, the prominent issues will be around the tests as well as the EF changes probably will take a longer time to isolate as well as fix up. It is quite great to be able to move the project forward and then get it to the 2.0 quite soon after the release. This is why asp net development services are counting on ASP.NET Core 2.0. It will help the developers in wanting to view and also work on real-world ASP.NET Core 2.0 applications and solutions.

tags:

dot net development services, asp dot net development, asp net development services

Top comments (0)