.NET › Assemblies & NuGet
What is the difference between a NuGet package's dependency group targeting different frameworks, and why do multi-targeted packages need this?
IntermediateAnswer
A single NuGet package (.nupkg) can bundle multiple sets of assemblies, each compiled for a different target framework (net472, netstandard2.0, net8.0), organized in a lib/{tfm}/ folder structure -- when a consuming project restores the package, NuGet automatically selects the best-matching assembly set for that project's own TargetFramework, letting one package serve both legacy Framework and modern .NET consumers from a single published artifact.
<!-- Library project multi-targets to produce one package supporting multiple consumers -->
<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0;net8.0</TargetFrameworks>
</PropertyGroup>
<!-- Resulting .nupkg structure:
lib/net472/MyLib.dll
lib/netstandard2.0/MyLib.dll
lib/net8.0/MyLib.dll -->Real-world example A popular open-source logging library publishes one NuGet package that automatically provides the correct assembly whether the consumer is a legacy .NET Framework 4.7.2 app or a modern .NET 8 application, without the consumer needing to think about it.