Questions on Versioning and Dependencies for .NET Components: SDK vs. NuGet Package Versions #110265
-
Question 1I'm developing a component. This component depends on the For example: <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" Condition="'$(TargetFramework)' == 'net6.0' "/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" Condition="'$(TargetFramework)' == 'net8.0' "/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="?.0.0" Condition="'$(TargetFramework)' == 'net48' "/> Question 2If I'm developing a component targeting only the .NET 6.0 framework, should I reference Choosing SDK versions and NuGet package versions is really confusing and troublesome for me. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
No, this is wrong. You should reference the same version of package, usually the latest one. Out-of-band NuGet packages are meant to be used with different versions of framework. The version number means the timeline of the package produced, but they are not tied to the framework version.
Use the latest version that provides support on the framework, in this case you should use
You are probably messed up with package version and supported framework version. The package version number itself isn't functionally meaningful. |
Beta Was this translation helpful? Give feedback.
No, this is wrong. You should reference the same version of package, usually the latest one. Out-of-band NuGet packages are meant to be used with different versions of framework. The version number means the timeline of the package produced, but they are not tied to the framework version.
Rarely, these packages may contain breaking change between versions. Using the same package version helps you ensuring the same feature and behavior.