ASP.NET 5 By Numbers

5.33 (9 votes)

There's a lot of confusion surrounding the numbers relating to the impending release of the next version of ASP.NET. This post takes a look at the main ones and seeks to explain their significance.

5

The new version of ASP.NET is called ASP.NET 5. It is a framework for developing web applications using the Model View Controller architecture. It also provides a RESTful services framework. In addition, a framework for building "real-time" web functionality will be included in the form of the next version of SignalR. ASP.NET 5 will not include any type of Web Forms development framework.

5 is also the number given to a new version of the .NET framework, also known as "Core50". I'll refer to it as .NET Core from now on. The .NET Core framework is a refactored version of .NET. It has been designed to include only a minimum subset of the full framework's features, massively reducing its footprint. Other features will be available as plugins via Nuget. This is particularly useful when you want to squeeze as much from a your cloud platform as you can. There will also be a cross-platform version of .NET Core. This will enable you to deploy ASP.NET apps that have been designed to target .NET Core on Mac and UNIX/Linux operating systems. The .NET Core framework can be bin-deployed with the app, making it possible to runs ASP.NET apps on the same server that target multiple versions of .NET Core. In other words, you won't have to wait for your hosting company to patch a server to be able to take advantage of any newer versions of the framework. The .NET Core framework will not include Web Forms, Windows Forms, WPF, WCF, Silverlight, System.Drawing, Datatables etc.

Some of the omissions, such as System.Drawing, may mean that you cannot migrate your existing application to .NET Core straightaway - if you use System.Drawing for generating thumbnails, for example. This kind of functionality will be made available as Nuget packages - in time. A tool should be made available to enable you to check the compatibility of your current app with.NET Core.

4.5.2

This is the current version of the full .NET framework. You can choose to target your ASP.NET 5 application against this version. You can actually target your ASP.NET 5 application against 4.5.1. ASP.NET 5 applications that target the full version of .NET will be able to take advantage of the entire .NET framework, but will not be cross platform.

4.6

The next full version of the .NET framework is 4.6. As well as .NET Core, you can target ASP.NET 5 applications to run on .NET 4.6. ASP.NET applications that have been designed to work with .NET 4.6 may not be compatible with .NET Core. The next version of ASP.NET Web Forms is also 4.6. It will include some enhancements such as async model binding, HTTP 2 and the ability to use the new Roselyn compiler. Existing ASP.NET applications (Web Forms, MVC 5 or lower, Web Pages) should all run on .NET 4.6 without modification.

6

ASP.NET 5 will see MVC, Web API and Web Pages merged into one framework called MVC 6. This merging will result in the removal of odd duplications among the existing frameworks which aren't quite duplications, such as different controllers for MVC and Web API, or similar looking HTML helpers in both MVC and Web Pages which are implemented completely differently. Web Pages won't be available as a development model when ASP.NET 5 is released to market, so it's difficult to say at this stage what it will look like, but one can assume that traditional MVC features like Model Binding will be available to it. We are told that Web Pages will be available in the first update after RTM. Microsoft still see Web Pages as an important platform for beginners and SPA development.

MVC 6 will see the introduction of some new features, the most noticeable of which are Tag Helpers and View Components. Tag helpers are an optional replacement for Html helpers in your views. Here's a standard piece of MVC 5 (from the default template's Register.cshtml view:

@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
    @Html.AntiForgeryToken()
    <h4>Create a new account.</h4>
    <hr />
    @Html.ValidationSummary(true, "", new { @class = "text-danger" })
    <div class="form-group">
        @Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @Html.TextBoxFor(m => m.UserName, new { @class = "form-control" })
        </div>
    </div>

And here's how it will look when the HTML helpers are replaced with Tag helpers:

<form asp-controller="Account" asp-action="Register" method="post" class="form-horizontal" role="form">
    <h4>Create a new account.</h4>
    <hr />
    <div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
    <div class="form-group">
        <label asp-for="UserName" class="col-md-2 control-label"></label>
        <div class="col-md-10">
            <input asp-for="UserName" class="form-control" />
            <span asp-validation-for="UserName" class="text-danger"></span>
        </div>
    </div>

This feature is still under development and there is no support for it in Visual Studio 2015 CTP 6 (Beta 3) - unless my installation went wrong.

View Components are intended to replace the widgets that you usually call into your layout or view using Html.Action, such as menus, tag clouds, the Archive listing on the right hand side of this page and so on. Here's a very simple view component that generates a greeting based on the time of day:

namespace WebApplication1.ViewComponents
{
    using Microsoft.AspNet.Mvc;
    using System;

    public class GreetingViewComponent : ViewComponent
    {
        public IViewComponentResult Invoke()
        {
            var greeting = "Good Morning!";
            if (DateTime.Now.Hour > 12)
            {
                greeting = "Good Afternoon!";
            }
            if (DateTime.Now.Hour > 17)
            {
                greeting = "Good Evening!";
            }
            return View("Index", greeting);
        }
    }
}

The view component needs a view:

@model string
<h3>@Model</h3>

It is rendered as a result of a call to Component.Invoke in the parent view:

<div>
    @Component.Invoke("Greeting")
</div>

There is also a Component.InvokeAsync method so you can make your view component asynchronous. You can read more about view components on the ASP.NET site.

7

Although not part of ASP.NET, the next version of the Entity Framework is also under development. Entity Framework 7 will be released with the RTM of ASP.NET 5, although the EF team warn that EF 7 will not be the "go-to-release" at that point. What should be ready at that stage is a basic ORM package that will run on .NET Core. It will not include lazy loading, inheritance mapping and will only target SQL Server. If you don't have any reason to target the cloud optimised cross-platform runtime, you can use EF 6 in your new MVC 6 application instead, and target .NET 4.5.2. or 4.6

Summary

The purpose of this post was to clarify the various new pieces that will be made available to ASP.NET developers over the coming months. The next version of ASP.NET is still under active development and changes are being made all the time. In fact, just last week, after the release of CTP6, it was announced that runtime will be renamed from 'kre' to DNX.

If you want to keep up to date with the latest news about ASP.NET 5, you should watch the Community Standups every Tuesday (or whenever you like).

You might also like...

Date Posted:
Last Updated:
Posted by:
Total Views to date: 11385

4 Comments

- Satyabrata Mohapatra

Thanks for sharing.Very helpful.

- Paul Thiel

Comments Below:

"The new version of ASP.NET is called ASP.NET 5. It is a framework for developing web applications using the Model View Controller architecture. It also provides a RESTful services framework. "

Already have this...nothing new.

"In addition, a framework for building "real-time" web functionality will be included in the form of the next version of SignalR."

Whatever....

"ASP.NET 5 will not include any type of Web Forms development framework."

Ah, cool...kill off the most successful development platform MS has ever created (well, old school VB might rival it).

"5 is also the number given to a new version of the .NET framework, also known as "Core50". I'll refer to it as .NET Core from now on. The .NET Core framework is a refactored version of .NET. It has been designed to include only a minimum subset of the full framework's features, massively reducing its footprint. "

Refactored = Broken

Great, let's violate one of the key principals of OOP...Change the implementation, not the interface.

"Other features will be available as plugins via Nuget. This is particularly useful when you want to squeeze as much from a your cloud platform as you can. "

Already have it...since 2012

"There will also be a cross-platform version of .NET Core. This will enable you to deploy ASP.NET apps that have been designed to target .NET Core on Mac and UNIX/Linux operating systems. "

Yawn...If I wanted to be a mac developer, I would be one. The mobile aspect is pretty cool, though.

"The .NET Core framework can be bin-deployed with the app, making it possible to runs ASP.NET apps on the same server that target multiple versions of .NET Core. In other words, you won't have to wait for your hosting company to patch a server to be able to take advantage of any newer versions of the framework. "

Great solution to a non-problem. If my hosting provider doesn't upgrade in a timely manner, I change hosting providers.

"The .NET Core framework will not include Web Forms, Windows Forms, WPF, WCF, Silverlight, System.Drawing, Datatables etc.

Some of the omissions, such as System.Drawing, may mean that you cannot migrate your existing application to .NET Core straightaway - if you use System.Drawing for generating thumbnails, for example. This kind of functionality will be made available as Nuget packages - in time. A tool should be made available to enable you to check the compatibility of your current app with.NET Core."

Please see "Broken Code" above.

What I'm reading here is that the open source community has stormed the gates of MS and we are getting updates to stuff that already works, a couple new things we don't really need, and a whole lot of headaches as all our stuff breaks.

Why don't they just call this thing Visual Studio Vista? I'm guessing most of the items that have been removed will be added into VS2017 as new "features"

Hopefully, this is the last remnant of the Ballmer years and we can get away from this "flavor of the day" model.

- Mike

@Paul

As far as I know, this new direction is in response to customer demands and is very much in line with the post-Ballmer era in which MS are now focusing on cloud and mobile.

None of this will beak existing apps. You don't have to move across to ASP.NET 5. Web Forms will continue to be supported for as long as the .NET framework exists.

- Robert

I have to agree fully with Paul, this does sound like an entire mis-mash of technologies. Sort of like leading from behind rather than getting out in front of it and pushing a logical front. Everyone would like cross platform features but this is implying is that there will be so few features available natively that you will be relegated to nothing or using javascript for the majority of coding. Javascript is fine and has it's place but this push to use just javascript has made web apps difficult to code, test and things like razor has put significant code into the html layer which can neither be properly error handled and certainly leaves us with no separation of code and design. There is a better way I believe and this really doesn't sound like it. Again Microsoft had a vision at one time and now they are just letting a variety of competing constructs enter the lexicon so that they can be all things to all people without taking a direction. It's wrong-headedness in my view but then what do i know I have only built web apps for last 20 years. No matter which way you choose to approach now it will be incorrect in 12 months and you will likely be left unsupported. aka WebForms disappearing because why, they work too well?

Recent Comments

Sivu 19/10/2016 08:21
In response to Entity Framework Core TrackGraph For Disconnected Data
Oh that's very very very nice ! Thanks for the write up Mike, much appreciated for the taking the to...

Mark 12/10/2016 16:42
In response to ASP.NET Web Pages vNext or Razor Pages
Although "Web Pages" was removed from the roadmap, has it just been renamed to "Razor Pages"?...

Satyabrata 12/10/2016 09:20
In response to Entity Framework Core TrackGraph For Disconnected Data
Nice article. Please write more articles featuring ASP.Net web pages. Thank you...

Julian 26/09/2016 14:27
In response to Loading ASP.NET Core MVC Views From A Database Or Other Location
Fantastic, many thanks Mike! Had got half way down this road before finding your article - saved...

Abolfazl Roshanzamir 14/09/2016 05:36
In response to Loading ASP.NET Core MVC Views From A Database Or Other Location
Nice article. Thanke you so much ....

cyrus 02/09/2016 15:12
In response to ASP.NET Web Pages vNext or Razor Pages
I've got some news. As Damian stated in this link: https://github.com/aspnet/Mvc/issues/5208 “We...

Simon 01/09/2016 08:00
In response to Loading ASP.NET Core MVC Views From A Database Or Other Location
Thanks Mike, nice post and exactly what I was looking for. Like you said, I think I'll opt to the...

dave 20/08/2016 14:57
In response to ASP.NET Web Pages vNext or Razor Pages
Do SimplemembershipProvider in viewpages is supported?...

Steven 18/08/2016 04:40
In response to Entity Framework Code First and Stored Procedures
Can you provide the directives (using statements) you're using for EF7 example?...

yousaid 17/08/2016 22:08
In response to ASP.NET Web Pages vNext or Razor Pages
Increasingly, learning a Microsoft tool is no longer worth the return on investment. Too many tools...