Setup
Say I have a .Net Standard 2.0 class library project and I add a Nu NuGet package that is compatible with .Net Standard 2.0 to it.
I then reference that class library project from both a .Net Framework console project and a .Net Core console project.
To restate with a picture:
Question
How does each of the console applications deal with getting the right NuGet code for their type of application?
Notes
Note: I tried this using Microsoft.Extensions.DependencyInjection, and it works fine in the .Net Core 3.1 console app, but throws a "File Not Found" exception in the .Net Framework 4.7.2 console app (looking for the Dependency Injection DLL). This leads me to believe that .Net Standard 2.0 NuGets are really .Net Core NuGets...
Note to the Note: I am trying to understand what happens here, not fix the "File Not Found" issue. (That is easily fixable by referencing the Microsoft.Extensions.DependencyInjection NuGet in the .Net Framework 4.7.2 console app).
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
to your .NET Framework console project in a PropertyGroup and run a restore then that should get msbuild to opt in to this behaviour. The RestoreProjectStyle is needed if the .NET Framework console project does not use any PackageReferences. – Siva