Introduction to ASP.NET vNext

ASP.Net Core
5/31/2014 3:52:00 PM +00:00

Microsoft ASP.NET is now being re-written from scratch to support following important goals:

A preview of the Microsoft ASP.NET vNext was announced on 12th May 2014 at its TechEd event. It is an open-source project and part of recently announced .Net Foundation which now including ASP.NET vNext has a collection of 25 open-source projects.

Core CLR

That old monolithic CLR has been made significantly small by removing the components that are not needed in every project and moved these into their own assemblies. This resulted in a light weight CLR, that is now referred as Core CLR.

It is an SDK that is used to both compile and run applications and can run directly from application's bin directory

KRuntime makes sure that it itself could run independent of any dependency defined by the project, which makes it self-sufficient as much as possible. As a result it doesn't need to traverse all application dependencies before loading core CLR.

New Project.json file

Runtime looks for project.json file in the project directory to compile and run the application. It contains following information:

    Project metadata, such as name, version etc. that used to be stored in AssemblyInfo.cs.
    Project dependencies,
    Supported commands,
    Information similar to that found in packages.config and .nuspec files,
    Some other related information.

There is some information that is convention based, such as project name is determined from the directory name that contains the project.json file.

Project.json does not contain any VisualStudio related information and is not the replacement of .csproj. Currently there is no support of vNext in VisualStudio, but it is expected that when the support will be added, it will include a .csproj file, however project.json file would continue to keep only project specific information.

Startup class

A new Startup class has been added to replace Global.asax file.

Project dependencies

These are defined in project.json file with only a name and a version of each.

There may be different types of dependencies in project.json file, such as a NuGet package, or a project that needs to be compiled (similar to project reference in .csproj file), or compiled assemblies on disk. Runtime uses different types of loaders for loading these different types of dependencies. Making NuGet packages part of project.json implies that NuGet is now becoming a primary source of reference.

Roslyn compiler

It is a new .Net Compiler Platform that enables developers to make changes to web applications and see the results  in next visit to the web site. Since CLR now loads application significantly faster, it doesn't terribly impact next load performance.

Enhancements in other frameworks

ASP.NET vNext includes updated versions of MVC, Web API, Web Pages, SignalR and EF.

MVC, Web API and Web Pages have been unified and merged into single framework, which means:

Routing, Model binding and filters are using same API
Controllers can return both HTML or JSON to represent views or data

Similar to how on-demand components are removed from CLR, many components are removed from EntityFramework making it slim and light weight enough to enhance performance.