Search⌘ K
AI Features

.NET Standards, Compatibility, and Management

Explore the role of .NET Standard in enabling code compatibility across various .NET platforms such as .NET Core, Framework, and Xamarin. Learn how to choose appropriate .NET Standard versions and manage SDK targets to ensure smooth packaging and deployment of class libraries for cross-platform .NET applications.

.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.

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. ...