检测到的包降级:Microsoft.NETCore.App从2.1.3降到2.1.0 [英] Detected package downgrade: Microsoft.NETCore.App from 2.1.3 to 2.1.0

查看:476
本文介绍了检测到的包降级:Microsoft.NETCore.App从2.1.3降到2.1.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将.net解决方案从.NET Core 1.1更新到.NET Core 2.1。我内部有几个.NET Core和.NET标准项目,它们相互引用并提供另一个NuGet包。更新后, dotnet resore和 dotnet build命令可以正常工作,但是当我尝试从Visual Studio构建解决方案时,出现此错误:

I try to update my .net solution from .NET Core 1.1 to .NET Core 2.1. I have several .NET Core and .NET standard projects inside, which reference each other and another NuGet packages. After update 'dotnet resore' and 'dotnet build' commands work fine, but when i try to build my solution from visual studio, i get this error:


错误NU1605检测到程序包降级:Microsoft.NETCore.App从2.1.3降到2.1.0。直接从项目中引用包以选择其他版本。

Error NU1605 Detected package downgrade: Microsoft.NETCore.App from 2.1.3 to 2.1.0. Reference the package directly from the project to select a different version.

我确实发现我的一些项目的SDK引用了Microsoft.NETCore.App v2.1.0,其中一些v。 2.1.3。设置RuntimeFrameworkVersion并将此程序包显式添加到依赖项将不起作用。

And i see that indeed some of my projects have SDK reference to Microsoft.NETCore.App v2.1.0 and some of them v.2.1.3. Setting RuntimeFrameworkVersion and adding this package to dependencies explicitly doesn't work.

我该如何处理?

UPD:
dotnet --info:

UPD: dotnet --info:

.NET Core SDK (reflecting any global.json):  Version:   2.1.401  Commit:    91b1c13032

Runtime Environment:  OS Name:     Windows  OS Version:  10.0.17134  OS Platform: Windows  RID:         win10-x64  Base Path:   C:\Program Files\dotnet\sdk\2.1.401\

Host (useful for support):   Version: 2.1.3   Commit:  124038c13e

.NET Core SDKs installed:
  1.1.10 [C:\Program Files\dotnet\sdk]
  2.0.0 [C:\Program Files\dotnet\sdk]
  2.1.4 [C:\Program Files\dotnet\sdk]
  2.1.100 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.400 [C:\Program Files\dotnet\sdk]
  2.1.401 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:   Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]   Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]   Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]   Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]   Microsoft.NETCore.App
1.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]   Microsoft.NETCore.App 1.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]   Microsoft.NETCore.App
2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]   Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]   Microsoft.NETCore.App
2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]   Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]   Microsoft.NETCore.App
2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:   https://aka.ms/dotnet-download

UPD:
如果我从.csproj文件中删除此行,则问题消失了:

UPD: Somehow issue disappears if i remove this line from .csproj file:

< RuntimeIdentifier> win7-x64< / RuntimeIdentifier>

可以关联吗?

推荐答案

我也遇到了类似的问题。指定运行时标识符后,无法发布我的项目。

I had a similar issue to you. Could not publish my project when I specified a runtime identifier.

我要工作的解决方案是将以下行添加到* .csproj

The solution I got to work was to add in the following line to the *.csproj

<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>

添加该行后,项目将正确发布。

After that line was added the project would publish correctly.

下面的链接引用了2.1.1和2.1.0之间的降级问题,但是解决方案的工作原理相同。

The below link references a downgrade issue between 2.1.1 and 2.1.0 but the solution worked the same.

https://github.com/dotnet/cli/issues/9624

这篇关于检测到的包降级:Microsoft.NETCore.App从2.1.3降到2.1.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆