本文介绍了如何更正dotnet恢复警告NU1604,不包含下限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在.NET Core项目(以.netcoreapp2.0为目标)上执行 dotnet还原时,出现以下警告:

While performing a dotnet restore on a .NET Core project (targeting .netcoreapp2.0.), I get the following warning:

这是项目文件中的相关行:

Here is the relevant line from the project file:

<PackageReference Include="System.Net.NameResolution" Verison="4.3.0" />

(如果您想知道,我加入了该引用以避免NU1605警告:检测到软件包降级。 )

(If you are wondering, I have included that reference to avoid a warning NU1605: Detected package downgrade.)

一个人如何在依赖版本中包含下限以确保一致的还原结果?

How does one "include a lower bound in the dependency version to ensure consistent restore results"?

推荐答案

为了指示软件包引用的最低版本,您必须将引用的 Version 属性设置为包含下限的范围。正如@Carter指出的那样,

If you don't specify an inclusive lower bound for your references, each restore will try to find a lower version of the package that can be used. More information about that warning can be found on the nuget errors and warnings reference page

唯一的问题似乎是您有错字( Verison 而不是版本)。因此,该行应为

The only problem with your reference seems to be that you have a typo (Verison instead of Version). So the line should be

<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />

在此行中,表示项目需要版本为 4.3.0 或更高版本的软件包 System.Net.NameResolution ,因此包含 4.3.0 的下限。

With this line, you indicate that the project requires the version 4.3.0 or above of the package System.Net.NameResolution, hence the inclusive lower bound on 4.3.0.

这篇关于如何更正dotnet恢复警告NU1604,不包含下限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 23:13