While investigating recommended target frameworks for NuGet packages I discovered that the package Microsoft.Extensions.Hosting.Abstractions has a reference to Microsoft.Bcl.AsyncInterfaces in all versions above 3.1.0 for netstandard2.0 target framework. This causes projects that targets netstandard2.1 references this package incorrectly reference this.
Steps to reproduce the behavior:
Microsoft.Extensions.Hosting.AbstractionsMicrosoft.Bcl.AsyncInterfaces are referenced.If it is a fact that Microsoft.Extensions.Hosting.Abstractions needs async interfaces after 3.1.0, it must explicit add a target reference to netstandard2.1 where this package is excluded from reference.
The package Microsoft.Extensions.Hosting has target reference netstandard2.1 with the removal of this reference as the only difference, so it should be the same for Microsoft.Extensions.Hosting.Abstractions too.
I am not sure if this applies to other packages, but it is worth investigating which packages that should use netstandard2.1 and not.. It may be more something that should be investigated as a whole, not only for the extensions project.
Tagging subscribers to this area: @safern, @viktorhofer
Notify danmosemsft if you want to be subscribed.
@ericstj this was marked as a 5.0 candidate pre-transfer. Not sure how you want to record that in dotnet/runtime, but I put it in the 5.0 milestone.
I put it in the 5.0 milestone.
That's exactly what we should do.
The work here is to do a pass on all the Microsoft.Extensions projects and make sure they are cross-compiling for most appropriate configurations.
We need to do things like:
Microsoft.BCL packages in the latest TFM. Also we should look for cases where we can make the TFM more generic (eg: netstandard2.1 instead of netcoreapp3.0).cc @joperezr this might be a "while you're in there" change when you add .NETFramework TFMs to these libs.
Most helpful comment
That's exactly what we should do.