加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

.net – NuGet解析了错误的包依赖版本

发布时间:2020-12-13 20:11:24 所属栏目:百科 来源:网络整理
导读:所以我有一个NServiceBus.Host包依赖于NServiceBus = 4.5.0. 在nuget上有一个4.5.1版本的NServiceBus.当我安装包NServiceBus.Host我得到: PM install-package nservicebus.hostAttempting to resolve dependency 'NServiceBus (≥ 4.5.0)'.Attempting to re
所以我有一个NServiceBus.Host包依赖于NServiceBus> = 4.5.0.

在nuget上有一个4.5.1版本的NServiceBus.当我安装包NServiceBus.Host我得到:

PM> install-package nservicebus.host
Attempting to resolve dependency 'NServiceBus (≥ 4.5.0)'.
Attempting to resolve dependency 'NServiceBus.Interfaces (≥ 4.5.0)'.
Installing 'NServiceBus.Interfaces 4.5.0'.
You are downloading NServiceBus.Interfaces from NServiceBus Ltd,the license agreement to which is available at http://particular.net/LicenseAgreement. Check the package for additional dependencies,which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s),then delete the relevant components from your device.
Successfully installed 'NServiceBus.Interfaces 4.5.0'.
Installing 'NServiceBus 4.5.0'.

如您所见,我得到4.5.0版本的依赖项.

在nuget doco它说:

If the dependency is not installed,NuGet goes through the following
steps:

NuGet enumerates every version of Subkismet within the feed that’s
within the version specification. NuGet then narrows that set to just
the packages with the lowest Major/Minor version. Of the remaining
packages,NuGet picks the one with the highest version number.

“NuGet选择版本号最高的那个.”似乎在这里违反了,因为从来没有版本.

这是NuGet中的错误吗?

自2010年12月以来,您所引用的依赖性解析的NuGet文档尚未更新.真正的NuGet文档可在此处获取: https://docs.nuget.org

此外,NuGet将 – 默认情况下 – 解析允许范围内的最低major.minor版本,如包依赖项中所定义.所以4.5.0是一个正确的默认依赖解析.

自NuGet v2.8.1以来的新功能:您可以使用NuGet包管理器控制台使用备用依赖项解析算法:

Install-Package NServiceBus.Host -DependencyVersion HighestPatch

还有更多选项,请查看以下文档:
https://docs.nuget.org/docs/reference/package-manager-console-powershell-reference#Install-Package

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读