Detected package downgrade warning (dotnet core, vs 2017)

This generally happens because the item you are attempting to install requires a more recent version of a sub-dependency than you have already included in your project.

The solution is to update or delete the existing dependency that is in your project prior to installing the package.

Example:

Detected package downgrade: Newtonsoft.Json from 9.0.0 to 8.0.0.

This means you have Newtonsoft.Json 8.0.0 already listed as a dependency in your project, but the package you are trying to install requires at least version 9.0.0 as a dependency.

This is because Visual studio won't automatically upgrade this dependency as you've specified an explicit version for your project. You can either upgrade the dependency in your project to the minimum required version or remove it from your project, and let the package you're installing handle it.

To resolve this, in our example above, this would mean finding 'Newtonsoft.Json 8.0.0' and upgrading it to version '9.0.0' or simply removing it from your project prior to installing your package.


This situation occurred to me after opening an existing solution but instead of Warnings, they were Errors.

I opened the YourAwesomeApp.csproj file and went through the "Detected package downgrade" errors one-by-one and manually changed the version of that line item from the existing version to the specified version that was shown in the error itself.

For example, if the Error says downgrade detected "SqlServer 1.0.4 -> 1.0.3" then find the line for package SqlServer and edit the version from 1.0.3 to 1.0.4.

Those errors should disappear after building the project.

The downside to this that I only had 5 errors this time but what if another person's project contained say 50 such errors. Then that person's task of manually editing those lines would be very tedious and time-consuming.