...

/

.NET Standards, Compatibility, and Management

.NET Standards, Compatibility, and Management

Learn about creating the .NET Standard class libraries, choosing the appropriate .NET Standard version, and controlling the .NET SDK version.

.NET Standard libraries are our gateway to writing code that seamlessly spans various .NET platforms, such as .NET Core, .NET Framework, and Xamarin. These libraries provide a standardized way to share code across different environments. Let’s explore it.

Sharing code with legacy platforms using .NET Standard

Before .NET Standard, there were Portable Class Libraries (PCLs). With PCLs, we could create a code library and explicitly specify which platforms we want the library to support, such as Xamarin, Silverlight, and Windows 8. Our library could then use the intersection of APIs supported by the specified platforms.

Press + to interact

Evolution of .NET Standards

Microsoft realized this was unsustainable, so they created .NET Standard—a single API that all future .NET platforms would support. There are older versions of .NET Standard, but .NET Standard 2.0 was an attempt to unify all important recent .NET platforms. .NET Standard 2.1 was released in late 2019, but only .NET Core 3.0 and that year’s version of Xamarin support its new features. We will use the term .NET Standard to mean .NET Standard 2.0.

.NET Standard vs. HTML5

.NET Standard is similar to HTML5 in that both define a standard that platforms are expected to support. Just as Google Chrome and Microsoft Edge implement the HTML5 standard, .NET Core, .NET Framework, and Xamarin implement .NET Standard. If you want to create a library of types that ...