Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the "Detected package downgrade" warning mean?

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:

  • What is a "package downgrade", in this context?
  • What causes a "package downgrade" to happen?
  • What do the lines below the "Detected package downgrade" mean? In particular, what do the arrows (->) between packages there convey?
like image 776
Mark Amery Avatar asked Jun 01 '17 12:06

Mark Amery


1 Answers

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.

like image 163
Martin Ullrich Avatar answered Sep 20 '22 16:09

Martin Ullrich