70 likes | 86 Views
Microsoft has already released version 2.0 of ASP.Net Core along with .Net Core 2.0. .Net Core 2.0 enables developers to avail several new class libraries and over 20000 new application programming interfaces (APIs) by supporting .Net Standard 2.0. The developers can upgrade their existing applications to ASP.Net Core 2.0 to take advantage of the new APIs supported by .Net Core 2.0. Also, they can write high quality code by availing the new language features provided by C# 7.1. At the same time, ASP.Net Core 2.0 also comes with several new features and improvements.
E N D
o Microsoft has already released version 2.0 of ASP.Net Core along with .Net Core 2.0. .Net Core 2.0 enables developers to avail several new class libraries and over 20000 new application programming interfaces (APIs) by supporting .Net Standard 2.0. o The developers can upgrade their existing applications to ASP.Net Core 2.0 to take advantage of the new APIs supported by .Net Core 2.0. Also, they can write high quality code by availing the new language features provided by C# 7.1. At the same time, ASP.Net Core 2.0 also comes with several new features and improvements. o It comes with a new coding paradigm called Razor Pages. The developers can use Razor Pages as a page first structure and a lightweight alternative to ASP.Net MVC. o Razor Pages allows programmers to create razor views based on PageModel without using controllers. Also, the coding paradigm contains the entire code for a specific page in a single file. Hence, developers can upgrade their existing applications to ASP.Net Core 2.0 to take advantage of the new features and APIs. However, the developers must keep in mind some simple points while upgrading from ASP.Net Core 1.x to ASP.Net Core 2.0.
Important Points to Consider while Upgrading to ASP.Net Core 2.0 Deciding the Right Way to Upgrade Microsoft allows developers to upgrade existing applications to ASP.Net Core 2.0 in two distinct ways. If the application is developed by targeting .Net Core 1.0, the developers can upgrade it simply by upgrading the targeted framework to .NET Core 2.0. They need to change the innertext of the <TargetFramework> node to netcoreapp2.0 in the .csproj file. On the other hand, the developers have to install the version 2.0 of .Net Core along with ASP.Net Core 2.0 if the application is developed without targeting .Net Core.
Upgrade the Package Reference In version 1.0 of ASP.Net Core, the .csproj file lists the Nuget packages used by the project individually. ASP.Net Core 2.0 replaces the collection of individual Nuget packages with a single metapackage reference called Microsoft.AspNetCore.All. The metapackage reference includes the core packages of both ASP.Net and Entity Framework, along with additional dependencies required by the programmer. Hence, the developers have to update the package references while upgrading the existing application to Microsoft.AspNetCore.All.
Update the Main Method While using, the programmers can take advantage of a simpler Main method in the Programs.cs. The simplified Main method even does not require programmers to write additional lines of code. Hence, the developers must update the Main method of the Programs.cs file while upgrading from version 1.x to version 2.0 of ASP.Net Core. The updated Main method will enable developers to take advantage of the new features provided by ASP.Net Core 2.0 and work with Entity Framework Core 2.0. Also, the developers can avoid a number of coding errors by updating the Main method.
Update the Startup Class In addition to updating the Main method, the developers also need to update the Startup class while upgrading to ASP.Net Core 2.0. They are no longer to set up Logging and Configuration as part of the Startup class. Instead, they have to move the move the Logging and Configuration setup to the simplified Main method. They can even use the WebHostBuilder to add both Configuration and Logging to the Program class. The option enables ASP Net developers to use Configuration and Logging as core services while working with ASP.Net Core 2.0.