简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM