When I run dotnet restore
(or run package restore in Visual Studio), I see warnings like this:
- /usr/local/share/dotnet/sdk/1.0.4/NuGet.targets(97,5): warning : Detected package downgrade: Microsoft.EntityFrameworkCore.Design from 1.1.1 to 1.0.3 [/Users/markamery/somesolution/SomeSolution.sln]
- /usr/local/share/dotnet/sdk/1.0.4/NuGet.targets(97,5): warning : SomeProject (>= 1.0.0) -> Microsoft.EntityFrameworkCore.Tools (>= 1.1.0) -> Microsoft.EntityFrameworkCore.Design (>= 1.1.1) [/Users/markamery/somesolution/SomeSolution.sln]
- /usr/local/share/dotnet/sdk/1.0.4/NuGet.targets(97,5): warning : SomeProject (>= 1.0.0) -> Microsoft.EntityFrameworkCore.Design (>= 1.0.3) [/Users/markamery/somesolution/SomeSolution.sln]
I'm struggling to parse the meaning of the warning above. Various things are unclear to me:
->
) between packages there convey?In this case your dependency graph references two version of Microsoft.EntityFrameworkCore.Design
. This is indicated by the lines containing ->
:
After the first line, it shows that your project references Microsoft.EntityFrameworkCore.Tools
version 1.1.0
, which was resolved to a package that in turn references Microsoft.EntityFrameworkCore.Design
at version 1.1.1
.
Then it is shown that your package directly references Microsoft.EntityFrameworkCore.Design
at 1.0.3
.
The NuGet documentation for dependency resolution states a rule that will apply in this case:
Nearest wins
When the package graph for an application contains different versions of the same package, the package that's closest to the application in the graph is used and others are ignored. This allows an application to override any particular package version in the dependency graph.
This rule applies here since your app directly references a different version of the package than another dependency. Since this version is lower, NuGet emits a warning to alert you, since the other dependency might expect some functionality that is not present in a lower version. The documentation also includes a warning about this:
The Nearest Wins rule can result in a downgrade of the package version, thus potentially breaking other dependencies in the graph. Hence this rule is applied with a warning to alert the user.
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