Back to results for “.NET CLI”
.NET › Assemblies & NuGet

How does NuGet resolve version conflicts when two packages depend on different versions of the same transitive dependency?

Intermediate

Answer

Modern NuGet uses a resolution algorithm that generally selects the lowest version that satisfies all direct and transitive constraints for older-style ranges, but with PackageReference and central package management, NuGet more commonly applies 'nearest wins' with automatic upgrade to the highest specified minimum version among conflicting requirements, and warns (NU1605) if a downgrade would otherwise occur, requiring an explicit override.
<!-- PackageA needs Newtonsoft.Json 12.0, PackageB needs 13.0 --
     NuGet resolves to 13.0 (the higher constraint) automatically -->
<ItemGroup>
  <PackageReference Include="PackageA" Version="1.0" />
  <PackageReference Include="PackageB" Version="2.0" />
</ItemGroup>
Real-world example A build fails with an NU1605 'detected package downgrade' error after a new dependency is added, forcing the developer to explicitly bump a transitive dependency's version to resolve the conflict.

Common follow-ups: What does the NU1605 warning specifically mean?;How do you force a specific version of a transitive dependency?