rory.ap
rory.ap

Reputation: 35308

Referencing assemblies that are not part of .NET Standard

I'm trying to make sense of which APIs are part of or compatible with .NET Standard.

Take for example Microsoft.Win32.Registry. It's not part of .NET Standard because it's a platform-specific API (i.e. the Microsoft Windows platform). Accordingly, it's not listed in the "Applies To" section on MS Docs:

enter image description here

and the .NET API Browser doesn't list anything for it in .NET Standard:

enter image description here

However, if I'm building a .NET Standard class library, I can the package from NuGet:

enter image description here

I don't get any warnings. I thought it might have to do with the .NET Framework compatibility shim, but I set the version of .NET Standard below 2.0 and it still compiles.

What am I missing?

Upvotes: 3

Views: 225

Answers (1)

Stephen Kennedy
Stephen Kennedy

Reputation: 21568

Microsoft.Win32.Registry is not part of .NET Standard, but is available as a Windows-only Nuget package which targets .NET Standard 2.0 (expand "Dependencies" on the Nuget listing page to verify). This is known as a "Platform Extension".

You can look this up on apisof.net, where we see Microsoft.Win32.Registry support under ".NET Standard + Platform Extensions" but not - for the reason already stated - under ".NET Standard".

Upvotes: 1

Related Questions