Since .net standard is not an implementation, it's just a set of rules, what happens when a .net standard Class-Library project is built?
I would think that one could only build a .net framework or .net core (etc.) project (which can include a .net standard class-library's files). And yet it is possible to completely build a .net standard class library as a project.
(only a partial answer)
Take a look at what is shown when the Dependencies node is expanded:

A .NET Standard library ends up picking an implementation, in this case it is .NET Core.
Now why .NET Core as opposed to .NET Framework ?
I guess because it is platform agnostic and thus fits the paradigm of .NET Standard which is about openness, the same could not be said for the .NET Framework.
And what is the purpose of netstandard.dll ?
When you open it in the decompiler of your choice, you will see thousands of TypeForwardedTo attributes, i.e. its role is to forward .NET Standard types to an implementation.
Also, interestingly, it's not even written by Microsoft but by the Mono development team.
Microsoft Docs define .NET Standard as below:
.NET Standard is a formal specification of .NET APIs that are intended to be available on all .NET implementations. The motivation behind .NET Standard is to establish greater uniformity in the .NET ecosystem. ECMA 335 continues to establish uniformity for .NET implementation behavior, and while ECMA 335 specifies a small set of standard libraries, the .NET Standard specification encompasses a broader range of .NET APIs.
It is completely possible to build a .NET Standard project in isolation. But, how it can be consumed really depends on the version you are using. Choosing what version of .NET Standard you want to use depends on your use-case. Higher the version more APIs are available but it also means you can target fewer platforms.
Take a very simple example of .NET Standard 2.0 vs 2.1.
Let us say, you need to create a Client Library/ Nuget package for different applications to consume. If you choose .NET Standard 2.0, your library can be targeted by .NET Core 2.0+ and .NET Framework 4.6.1+ (with some caveats).
If however, you know that you will only have consumers on .NET Core 3.0 and above, it is safe to choose .NET Standard 2.1 as your target and get advantages of additional APIs and features available in the .NET Standard 2.1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With