I am about to create some Nuget packages and I am trying to find any recommendations for setting target frameworks for NuGet packages. Unfortunately I haven't found any good references for this (except the Cross-Platform targeting documentation which states that all libraries should reference netstandard2.0).
If I look at Microsofts NuGet packages they are doing it quite differently here are some examples from the extensions related packages:
- Microsoft.Extensions.DependencyInjection.Abstractions only refers to netstandard2.0
- Microsoft.Extensions.Logging refers to netcoreapp3.1 and netstandard2.0
- Microsoft.Extensions.DependencyInjection refers to netcoreapp3.1, netstandard2.1 and netstandard2.0.
- The netstandard2.0 uses the Microsoft.Bcl.AsyncInterfaces so this is a difference between that target and the others.
- Microsoft.Extensions.Hosting.Abstractions refers to netcoreapp3.1 and netstandard2.0
- Also here the netstandard2.0 uses the Microsoft.Bcl.AsyncInterfaces, but the difference is that in this package there is no netstandard2.1 reference which causes a library that references netstandard2.1 (that has support for async interfaces) to have a reference to this non-netstandard2.1 library?
So, does anyone have any reference/knowledge on how this is done "correctly"? When should I only refer netstandard2.0? Why should I refer netcoreapp3.x (or other netcoreapp versions) and not include netstandard2.1 (which the netcoreapp3.x is based on)?