I have two NuGet Packages. Package One, and package Two. Package Two needs to have an dependency as Package One version 1.0 or higher.
I have made a small change to Package One and re-built the NuGet Package to the version of 1.0.1. I have not made any changes to the Package Two NuGet package. I have also updated Package One in the solution I am working in.
The issue I am having is that Package Two is still trying to look for the .dll of Package One of version 1.0, an old version. Yet there is the newer version already installed and available to use, it is like it is ignoring it.
Package Two has the dependency of version 1.0 or higher of Package One in the package.nuspec
file.
Is there any way to resolve this?
Is there any way to resolve this?
Just as Matt answered "This is the default behaviour of NuGet":
With NuGet 2.5 and later, if a dependency version is already satisfied, the dependency isn't updated during other package installations.
So 1.0 is a correct default dependency resolution.
Since NuGet v2.8, we could use other dependency resolution algorithms:
Though NuGet 2.8 changes the default behavior for resolving dependencies, it also adds more precise control over dependency resolution process via the -DependencyVersion switch in the package manager console. The switch enables resolving dependencies to the lowest possible version (default behavior), the highest possible version, or the highest minor or patch version.
The detail information about the those dependency resolution algorithms, please check below document:
https://learn.microsoft.com/en-us/nuget/tools/ps-ref-install-package
To resolve this issue, you can use below command in the Package Manager Console:
Install-Package PackageTwo -DependencyVersion Highest
Or chose it from Manage NuGet package UI by expending Options:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With