Getting Started with ASP.NET Core 2.0
An overview of the official release of ASP.NET Core 2.0. Learn about the major improvements, including the massive API expansion with .NET Standard 2.0 and the new Razor Pages model, which make the framework easier to use than ever.
Today is a huge day for the .NET community with the official release of .NET Core 2.0 and ASP.NET Core 2.0. This release represents a massive leap forward in the usability and power of the platform, making it dramatically easier for developers to build modern, cross-platform web applications.
If .NET Core 1.0 was about establishing a new foundation, .NET Core 2.0 is about building a welcoming and productive home on top of it.
.NET Standard 2.0: The Game Changer
The single biggest story of this release is the arrival of .NET Standard 2.0. This new version of the standard more than doubles the number of available APIs, bringing them much closer to parity with the full .NET Framework.
This is a game-changer because it means:
- Massive Portability: A huge number of existing NuGet packages and shared libraries can now be retargeted to .NET Standard 2.0 and work seamlessly with .NET Core 2.0.
- Easier Migration: Porting existing .NET Framework code to .NET Core is now much, much easier, as the APIs you know and love are now available.
This solves the biggest pain point of the 1.x releases and makes .NET Core a viable platform for a much wider range of applications.
Razor Pages: A Simpler Way to Build Web UIs
ASP.NET Core 2.0 introduces a new programming model called Razor Pages. Razor Pages is a page-centric model that makes building web UIs simpler and more productive. In Razor Pages, the page logic (the C# code) and the view (the Razor markup) are kept together, which can be a more intuitive workflow for simple pages than the full MVC (Model-View-Controller) pattern.
// MyPage.cshtml.cs
public class MyPageModel : PageModel
{
public string Message { get; private set; }
public void OnGet()
{
Message = "Hello, from Razor Pages!";
}
}
Razor Pages is a great entry point for developers new to ASP.NET Core and a productive choice for page-focused applications.
Simplified Project Setup
In ASP.NET Core 1.x, a new project would have a long list of package references. In 2.0, this is simplified with a new metapackage, Microsoft.AspNetCore.All
. By referencing this single package, you get all the dependencies for ASP.NET Core and Entity Framework Core. The build process then intelligently trims out any assemblies your application doesn't actually use, so you don't pay a size penalty.
Simplified Configuration
The Program.cs
file, the entry point of the application, has also been simplified. The configuration of the web host is now hidden behind a CreateDefaultBuilder
method, which sets up a web server with a standard configuration, reducing the amount of boilerplate in your code.
A Mature and Ready Platform
ASP.NET Core 2.0 is a massive step forward. The combination of .NET Standard 2.0, Razor Pages, and the simplified project setup makes the platform more accessible, more powerful, and more productive than ever before.
With its world-class performance, cross-platform reach, and now a much more familiar and complete API surface, ASP.NET Core 2.0 is ready for prime time. It's a fantastic platform for building modern web applications of any scale.