The New Cross-Platform Standard: Version 2.0

The New Cross-Platform Standard: Version 2.0

Back in the early days, there was very little need to share code between applications. Though sharing files was sometimes needed between client and server apps, it was not regular. The .NET Framework has only worked on Window devices. The Xamarin and Mono projects worked together to bring .NET to latest technologies including smart devices. .NET Core provides a standard base library that can now be used across platforms like Windows, Linux, and mobile devices.

There are four major components of .NET architecture:

1. Common language specifications

2. Framework class library

3. Common language runtime

4. Tools like Visual Studio to create applications, interactive websites, web applications, and web services

Like every individual platform, they are designed in such a way to that they will meet specified requirements. Let us take the example of .NET applications, they are wrapped into single platform specific packages or even precompiled into machine code while others can be distributed as pure assemblies in IL. The real concern is the differences in class libraries that are available for individual .NET runtimes.

Custom Model Binding In ASP.NET Core MVC Pattern
Understand Custom Model Binding In ASP.NET Core and its use in MVC Pattern for better control of data. Custom binders provide a particular format to the model classes.

What is the key difference between .NET and .NET Framework?

Microsoft maintains both runtimes for building applications with .NET and they share many of the same APIs and this shared API is called .NET Standard. Usually, developers use the .NET framework to create Windows desktop applications and server-based applications whereas .NET Core is used to create server applications that run on Windows Linux and Mac. Just remember that .NET Core currently does not support creating desktop applications.

What’s new in Standard Version 2.0?

Microsoft has always had a blueprint plan to support cross-platform development using the .NET Framework. In initial days, Portable Class Libraries (PCL) was introduced by Microsoft to make cross-platform development easier, enabling the developer to define a common set of APIs that are available in all of the targeted runtimes.

During the development of the cross-platform application, common code can be put in a separate portable class library that only needs to be compiled once, that aimed one of its selected target platform. There is no requirement to have a different class library project for each platform, and include the same source code files in these multiple platform-specific projects. In other words, we can say all that needs to be done in UI and Data Binding of the application to be ready for Windows wen and mobile.

Some negative points about using PCL: Target platform and their versions are chosen in advance, to find out the intersection of the available APIs for use in the class library. This makes it impossible to target a newly relates the platform or we can say a new version of an existing platform until all the tooling is updated.

For the solution of this problem, the Dotnet Standard is built on the basic concepts of portable class libraries. Instead of determining the common API for the target platform, DotNet defines a set of APIs independent of them. In the latest Dotnet version, now the developer can select.Net standard version to target their class library. A library targeting specific Dotnet Standard versions will work any platform who implements the version is standard.

If you ever created a PCL project, you were given a list of platforms and asked to check off which ones you wanted to run on. After searching your choices, what you could access in your library was the intersection of the Dotnet Framework APIs supported on each of those platforms. It simply means that the more platform you checked off, the less of the Dotnet Framework you got to sue. The process was not dynamic and what you were picking was one of a set of predefined profiles that combined various Dotnet Framework APIs.

Microsoft New Approach for .NET Platform

This time Microsoft has a new approach that is known as Standard Class Library projects. In Standard Class Library, it consists of those APIs that are intended to be available on all Dotnet implementations. The news here we are talking about is that there is only one Standard and it supports all the asp.net web development platforms.

The comprehensiveness is also a big plus-point in .NET Standard. There have been many iterations of the .NET Standard specification. Each other’s specification includes more Dotnet Framework APIs. The latest version is Dotnet Standard 2.0.

More Features of .NET Platform on .NET Standards

.NET Standard supports the following platforms:

  • Mono: An open-source Dotnet created before Xamarin and Microsoft collaborated.
  • Universal Windows Platform: Software platform created by Microsoft to help in developing apps that run on Windows 10
  • Windows: Version 8.0 and 8.1 are supported
  • Windows Phone Silverlight: The application framework was designed to run internet applications.

All these above platforms implements .NET Standards – a common set of APIs that replaces portable Class Libraries. This feature helps in code sharing across desktop applications, mobile apps and game, and cloud services.