DotNet 5.4 or .NET Platform Standards

Yes, you read it right “DotNet 5.4“. Create a nuget class library using Visual Studio 2015 and RC 1 update. And take a look at the Project.json file, you will be surprised to see “DotNet 5.4” in the framework section. Recently ASP.NET 5 was renamed to ASP.NET Core 1.0, then from where DotNet 5.4 came from? They are yet to release RC 2 for ASP.NET Core 1.0 and I was like “Have I really missed the release of Dotnet 5.1 to 5.3? “.
Following is the screenshot of Project.json file. Notice the framework section.

What is DotNet 5.4 exactly

Recently when ASP.NET 5 was renamed to ASP.NET Core 1.0, it was appreciated by .NET community, but Microsoft does it again with “DotNet 5.4” to create confusion. Well, “DotNet 5.4” is not a real framework against which you are building and compiling your application. It’s “Platform Moniker” to a new approach called .NET Platform Standard.

So what’s .NET Platform Standard?

Before we move to .NET Platform Standard, it’s important to understand “why” a new standard? Well, the new standard is to bring all different monikers (.Net, Windows, Windows Phone, Mono, .NET Core, UWP, etc..) under a single moniker. It is created to provide a more concrete guarantee of binary portability to future .NET-capable platforms with an easier-to-understand platform versioning plan. Binary portability is achieved via PCL (Portable class library).

For readers unfamiliar with the PCL, it’s a type of project in Visual Studio. This type of project can produce a binary that can be referenced by a set of platforms. So when you create a PCL project, you will be asked about targeted platforms.

And the PCL will run only on selected frameworks. If we take an example of above image, then the PCL will run on .NET Framework 4.6, ASP.NET Core 1.0 and Windows Universal 10.0 platforms. And in the jargon of PCL, the term moniker is used to define platforms. So in above case there are 3 different monikers. And the issue is, if tomorrow a new platform comes then created PCL is not compatible with it. It needs to be re-published a new version of the library, adding the new platform in the target list. So PCL uses a predefined list of monikers to define the target platforms.

To address this issue, .NET Platform Standard is the answer. In this new approach, there is a single moniker. So library is no longer combination of monikers. Remember, The .NET Platform Standard is not a platform in and of itself. It is a standard that platforms are implemented to.

To understand how it works, see below matrix.

The above list is updated but when initially it was released the alias name given to “netstandard” was “dotnet” And the version number was 5.1 to 5.4, instead of 1.0 to 1.4 (as in image) So that’s when DOTNET 5.4 was introduced. Though the team did update the table, but reference in code is still there. And with release of ASP.NET Core 1.0 RC 2, this should be replaced to netstandard.

How to read this matrix

If a library targets .NET Platform Standard version 1.3, it can only run on .NET Framework 4.6 or later, Universal Windows Platform 10 (UWP), DNX Core 5.0 and Mono/Xamarin platforms.

If a library targets .NET Platform Standard version 1.3, it can consume libraries from all previous .NET Platform Standard versions (1.2, 1.1, 1.0).

Summary

As the release of ASP.NET Core 1.0 is coming near, things are settling down and moving into right direction. The name dilemma is already addressed .NET is changing and it can be considered as a platform. “.NET Platform Standard” is right step towards real binary portability.

That’s all folks. Keep visiting this blog and share this in your network. Please put your thoughts and feedback in comments section.

PS: If you found this content valuable and want to return the favour, then