[英]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.