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, why does all almost all new NuGet packages include the netcoreapp3.x target framework but don't include netstandard 2.1? I can see the reason of netstandard2.0, but not the reason for including netcoreapp3.x without or instead of netstandard2.1.
(The reason I write netcoreapp3.x instead of netcoreapp3.0 and/or netcoreapp3.1 is because this is done in both netcoreapp3.0 and netcoreapp3.1 versions of the NuGet packages).