Andy Lamb

Header image

Understanding .NET Runtimes

.NET icon

.NET Framework, .NET Standard, .NET Core, .NET 5... There's been alot of change in the .NET space in the last few years. The progression of .NET runtimes is well understood,

.NET Framework begat .NET Core begat .NET 5
But understanding the compatibility between them and how to migrate from one to another is more of a challenge...

The first thing you may notice is that .NET Standard doesn't appear in the .NET lineage above. That's because .NET Standard isn't a runtime in it's own right, it is a set of .NET APIs implemented by multiple .NET runtimes. .NET Standard is the grease that eases the adoption of a new .NET runtime by allowing libraries to support multiple runtimes with a single target.

A library built for .NET Standard 2.0 is compatible with .NET Framework, .NET Core, and .NET 5.

The following table, a subset of the table found in the Microsoft docs, shows the minimum compatibility between .NET Standard and the main runtimes considered here. Xamarin, Mono, etc, are included in the source table if that's of interest to you.

.NET Standard 1.0 1.1 1.2 1.3 1.4 1.5 1.6 2.0 2.1
.NET Core and .NET 5 1.0 1.0 1.0 1.0 1.0 1.0 1.0 2.0 3.0
.NET Framework 4.5 4.5 4.5.1 4.6 4.6.1 4.6.1 4.6.1 4.6.1 N/A

So creating .NET libraries just got a lot easier. By targetting the minimum version of .NET Standard the library can get away with, the library is compatible with the largest span of historic, current and future .NET runtimes. In reality, when only considering the .NET runtimes discussed here, there's little point in targetting anything less than .NET Standard 2.0. .NET Standard 2.0 is supported by .NET Framework, .NET Core and .NET 5. .NET Standard 2.1 doesn't support .NET Framework but does support a wider range of .NET 5 APIs.

There may be cases where some specific runtime API is required by a library, but that API isn't available through .NET Standard. While not ideal, this use-case has also been simplified; the dotnet CLI NuGet packaging features together with the introduction of mutli-target builds allows a single project to be built for multiple runtimes and bundled into a single package.

But .NET Standard won't be around forever. In .NET 5 it is no longer required because there are no longer multiple runtimes to support. .NET 5 is truely cross platform, with extended targets to handle esoteric platform specific features. .NET Standard 2.1 is the last version of .NET Standard; there will be no new versions, but .NET 5 and above will continue to maintain compatibility with .NET Standard for the forseeable future.

.NET Standard Support

© 2022 Andy Lamb