Thursday, July 17, 2014

[ASP.NET] ASP.NET vNext, the future of Microsoft Web Development

Microsoft has announced lately a preview of ASP.NET vNext, the next version of our preferred web development framework, which is going to be published as open source. I had already quickly mentioned it in one of my blog posts.

You can download and install the recently released Visual Studio “14” CTP2 for evaluation and testing purposes. CTP2 contains some additional features, when compared to the CTP1 version. I advise you to read the official Microsoft blog post. Note that you should install it to a clean VM, since there are some nasty compatibility issues if you install it over an existing Visual Studio 2013 installation.

The next version of ASP.NET will contain some major updates and breaking changes for web developers. It has been completely redesigned and improved to combine Web Pages, MVC, SignalR and Web API into a single common web development framework. This new framework is going to be called MVC6.

Here are some of the new features:

  • Web Pages and MVC support HTML5, CSS3 and JavaScript
  • Real-time bi-directional client-server communication is possible via SignalR
  • Web APIs support JSON and XML return formats
  • Fast startup time and low memory consumption
  • Running different versions of the ASP.NET vNext framework on the same server is supported (Side-by-Side deployment)
  • Dependency Injection is directly integrated in the ASP.NET vNext framework, no additional frameworks are necessary
  • Applications are host-agnostic, they run within IIS or within custom host processes
  • Roslyn compiler is now used for dynamic code compilation

ASP.NET vNext First Steps

In the following paragraphs you are going to see how to create a new ASP.NET vNext project from scratch. Please understand that Visual Studio 2014 and ASP.NET vNext are in an early CTP phase and that they still change, so there will surely be some differences in the final versions.

First of all you have to download and install Visual Studio 2014 CTP2 on a clean VM.

CTP2CTP22

After the installation you have .NET 4.5.3 installed and the new ASP.NET vNext templates are available in the “New Project” dialog, you have to select “ASP.NET vNext Web Application”.

vNext1

This will generate a new project and you will see the new project page, which contains additional information on the different options you have.

vNext3

The automatically generated project structure and project files show multiple differences when compared to traditional ASP.NET web applications.

vNext2

A new config.json file for runtime specific configurations (connection strings, …) and  a new project.json file for project specific configurations (dependencies, ...) have been added.

config

project

The Startup.cs file acts as entry point for ASP.NET vNext applications. Note the usage of the new Dependency Injection features of ASP.NET vNext in the example below.

Startup

In the final step you may now add your views, controllers, html and javascript files or modify the existing ones to get a better understanding on how to develop your web applications.

vNext4

You may now start the example application within your browser and see what gets displayed during runtime.

vNext5

Conclusion

This blog post has shown ASP.NET vNext also called ASP.NET MVC6. Microsoft has combined all modern web technologies (MVC, Web API, SignalR, Bootstrap Dependency Injection, …) into a single web development framework. I think that it has been done very carefully in the CTP version and I can’t wait to get the final version and play with it. Please try it out for yourself and give me your feedback.


Share/Save/Bookmark