BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News .NET Core and .NET Standard: What Is the Difference?

.NET Core and .NET Standard: What Is the Difference?

Leia em Português

This item in japanese

Bookmarks

Microsoft has just announced .NET Core 2.0, but confusion still exists among developers as to the differences between .NET Core, .NET Standard, Xamarin, and the .NET Framework

The .NET Framework is used for building desktop applications and ASP.NET applications running on Internet Information Server (IIS). It was the first managed framework released.

Xamarin is a managed framework used for building iOS, Android, and macOS desktop applications.

.NET Core

.NET Core is a free, cross-platform, open source implementation of the managed framework. It supports four types of applications: console, ASP.NET Core, cloud, and Universal Windows Platform (UWP). Windows Forms and Windows Presentation Foundation(WPF) are not part of .NET Core.

Technically, .NET Core only supports console applications. ASP.NET Core and UWP are application models built on top of .NET Core.

Unlike the .NET Framework, .NET Core is not considered a Windows component. Therefore, updates come as NuGet packages, not through Windows Update. Since the .NET Core runtime is installed App-Local, and applications are updated through the package manager, applications can be associated with a particular .NET Core version and be updated individually.

.NET Standard

Each implementation of the managed framework has its own set of Base Class Libraries. The Base Class Library (BCL) contains classes such as exception handling, strings, XML, I/O, networking, and collections.

.NET Standard is a specification for implementing the BCL. Since a .NET implementation is required to follow this standard, application developers will not have to worry about different versions of the BCL for each managed framework implementation.

Framework Class Libraries (FCL) such as WPF, WCF, and ASP.NET are not part of the BCL, and therefore are not included in .NET Standard.

The relationship between .NET Standard and a .NET implementation is the same as between the HTML specification and a browser. The second is an implementation of the first.

Hence, the .NET Framework, Xamarin, and .NET Core each implement .NET Standard for the BCL in their managed framework. Since the computer industry will continue to introduce new hardware and operating systems, there will be new managed frameworks for .NET. This standard allows application developers to know that there will be a consistent set of APIs that they can rely on.

Each .NET version has an associated version of the .NET Standard.

By providing consistent APIs, porting applications to different managed implementations, as well as providing tooling, is easier.

.NET Standard is defined as a single NuGet package because all .NET implementations are required to support it. Tooling becomes easier because the tools have a consistent set of APIs to use for a given version. You can also build a single library project for multiple .NET implementations.

You can also build .NET Standard wrappers for platform specific APIs.

.NET Standard vs Portable Class Libraries

Did not Portable Class Libraries do the same thing?

Portable Class used a union of the common APIs that a platform supported. Hence, the more platforms you supported, the fewer APIs available. It was then difficult to understand what APIs were actually supported for a given combination of platforms. With a new platform, the existing PCLs would have to be recompiled. PCLs also required Microsoft to create a new Framework implementation fork for each platform.

Since .NET Standard fixes the API, rather than an implementation, there is no need to recompile an application. Any new .NET implementation that gets released implements the required libraries. An application can target the new hardware platform or operating systems without any need to recompile.Theoretically, you could get a NotSupportedException from invoking an API, but that should be rare.

Conclusions

.NET Standard is an API specification that defines, for a given version, what Base Class Libraries must be implemented.

.NET Core is a managed framework that is optimized for building console, cloud, ASP.NET Core, and UWP applications. It provides an implementation of .NET Standard for the Base Class Libraries.

Rate this Article

Adoption
Style

BT