Our Blogs

Microsoft ASP.NET Core 2 Gets Better With Razor Pages

August 30, 2017
140 Views
Microsoft ASP.NET Core 2 Gets Better With Razor Pages
After the successful rollout of the NET Core 2 and Entity Framework Core 2.0, Microsoft has officially released ASP.NET Core 2.0 framework with support for Razor pages. The ASP.NET Core 2 package ships with several core features including improvements. In addition to perfrmance related gains, the ASP.NE Core 2 provides support for Razor pages, development templates and Azure diagnostics.

The newly introduced Razor pages look identical to that of a standard MVC view. However, it makes use of the @Page directive to signify that it is a Razor page. According to Microsoft, the Razor Pages is the best way to build UI for web based applications in ASP.NET Core. However, developers can make use of any approach that is comfortable for them. If you make use of Razor Pages, it enables web pages to directly handle requests without depending upon a controller.

The advantage of migrating to ASP.NET Core 2 is the availability of simplified package references. You just need to add a reference to Microsoft.AspNetCore in the .csproj file. It is a metapackage to ensure that all the required libraries required for your application are available instantly. Moreover, the use of a metapackage helps to achieve faster application startup time via .NET Core Runtime Store.

Microsoft has expanded the ASP.NET Core 2 templates in such way that it will be compatible with not only Razor Pages templates but also Web API, MVC, Angular, Reach.js, Redux and React.js files. It is possible to access all of these files via command line without Visual Studio 2017.

The Razor language engine provides support for C# 7.1. To work with the feature, you need to add the latest property to your project file. You should reload the solution after adding the required properties.
 
If you are a developer who makes use of the existing ASP.NET Core 1.X packages, it is advisable to refer to the official Microsoft upgrade guide for migration. To work with the ASP.NET 2.0, you need to download .NET Core 2 SDK, available separately from Visual Studio 2017.