简体   繁体   English

尝试解决“检测到的包降级”但由于多个版本问题而无法更新包

[英]Trying to resolve “Detected package downgrade” but cannot update-package because of multiple version issue

I'm getting build errors about 'package downgrade', eg: 我收到关于'package downgrade'的构建错误,例如:

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. 因此,为了尝试解决它,我将尝试将Microsoft.Extensions.Configuration.Json更新包到-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中的B更新为ver 2,因为还存在另一个类似的问题(当我运行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? 解决这一切的唯一方法是直接修改.csproj文件吗?

I ended up opening the .csproj in a text editor and modifying the version numbers there, eg. 我最终在文本编辑器中打开.csproj并修改那里的版本号,例如。

    <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. 然后保存,等待VS识别更改,重建解决方案。

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. 如果不清楚,我将版本修改为构建错误中报告的更高版本号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 dotnet cli - “检测到包降级” - dotnet cli - “detected package downgrade” 检测到错误 NU1605 package 降级 - Error NU1605 Detected package downgrade 检测到样板应用程序(.NET Core 3.1)的 package 降级 - Detected package downgrade for Boilerplate Application(.NET Core 3.1) 检测到 package 降级警告(dotnet core,vs 2017) - Detected package downgrade warning (dotnet core, vs 2017) 检测到 package 降级:Microsoft.NETCore.App 从 2.1.3 到 2.1.0 - Detected package downgrade: Microsoft.NETCore.App from 2.1.3 to 2.1.0 servicestack .netcore无法解析包 - servicestack .netcore cannot resolve package 修复 C# dotnetcore3.1 log4net 2.0.8:检测到包降级错误 - Fixing C# dotnetcore3.1 log4net 2.0.8: Detected package downgrade error 修复错误 NU1605 的正确方法是什么:检测到包降级 - log4net - What is the right way to fix error NU1605: Detected package downgrade - log4net Serilog,.NET 7,错误 NU1605(“检测到 package 降级”)和 Microsoft.NETCore.Targets - Serilog, .NET 7, error NU1605 ("detected package downgrade") and Microsoft.NETCore.Targets 出乎意料的降级? Nuget Package Manager未显示Microsoft.ServiceFabric.Services.Remoting的最新版本 - Unexpected downgrade? Nuget Package Manager doesn't show latest version for Microsoft.ServiceFabric.Services.Remoting
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM