gpt4 book ai didi

visual-studio - NuGet忽略较新版本的依赖项

转载 作者:行者123 更新时间:2023-12-04 03:41:42 24 4
gpt4 key购买 nike

我有两个 NuGet 包。套餐一,套餐二。包二需要依赖包一版本 1.0 或更高版本。

我对 Package One 做了一个小改动,并将 NuGet Package 重新构建到 1.0.1 版本。我没有对 Package Two NuGet 包进行任何更改。我还在我正在使用的解决方案中更新了 Package One。

我遇到的问题是包二仍在尝试查找版本 1.0(旧版本)的包一的 .dll。然而,已经安装并可以使用较新的版本,就像它忽略了它一样。

包二在 package.nuspec 中依赖包一的 1.0 或更高版本。文件。

有没有办法解决这个问题?

最佳答案

Is there any way to resolve this?



正如马特回答“这是 NuGet 的默认行为”:

With NuGet 2.5 and later, if a dependency version is already satisfied, the dependency isn't updated during other package installations.



所以 1.0 是一个正确的默认依赖解析。

NuGet v2.8 ,我们可以使用其他依赖解析算法:

Though NuGet 2.8 changes the default behavior for resolving dependencies, it also adds more precise control over dependency resolution process via the -DependencyVersion switch in the package manager console. The switch enables resolving dependencies to the lowest possible version (default behavior), the highest possible version, or the highest minor or patch version.



有关这些依赖解析算法的详细信息,请查看以下文档:

https://docs.microsoft.com/en-us/nuget/tools/ps-ref-install-package

enter image description here

要解决此问题,您可以在包管理器控制台中使用以下命令:
Install-Package PackageTwo -DependencyVersion Highest

或者通过花费 从管理 NuGet 包 UI 中选择它选项 :

enter image description here

关于visual-studio - NuGet忽略较新版本的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46486983/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com