Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to resolve "Detected package downgrade" but cannot update-package because of multiple version issue

I'm getting build errors about 'package downgrade', eg:

NU1605  Detected package downgrade: Microsoft.Extensions.Configuration.Json from 1.1.2 to 1.0.2. Reference the package directly from the project to select a different version. 
     Proj -> MySql.Data.EntityFrameworkCore.Design 6.10.5 -> MySql.Data 6.10.5 -> Microsoft.Extensions.Configuration.Json (>= 1.1.2) 
     Proj -> Microsoft.Extensions.Configuration.Json (>= 1.0.2) Proj C:\path\Proj .csproj   1   

So to try and resolve it I will try to update-package Microsoft.Extensions.Configuration.Json to -version 1.1.2. But that will fail telling me to upgrade some other package for same reason as above.

So, the problem is

PROJ -> A -> B (ver 2)
and
PROJ -> B (ver 1)

But I can't update B in PROJ to ver 2 because another similar problem also exists (this is reported when I run update-package B -version 2.0)

PROJ -> C -> D (ver 2)
and
PROJ -> D (ver 1)

Is the only way to resolve all this to tinker with the .csproj file directly?

like image 948
Jim W says reinstate Monica Avatar asked Jan 29 '23 01:01

Jim W says reinstate Monica


1 Answers

I ended up opening the .csproj in a text editor and modifying the version numbers there, eg.

    <PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.0.2" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.0.2" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.0.2" />

then save, wait for VS to recognize the change, rebuild solution.

It took a few iterations to fix all package versions necessary.

In case it isn't clear, I modified the version to the higher version number reported in the build error.

like image 193
Jim W says reinstate Monica Avatar answered Apr 25 '23 22:04

Jim W says reinstate Monica