gpt4 book ai didi

visual-studio - NuGet 不会在构建时恢复包

转载 作者:行者123 更新时间:2023-12-03 11:34:32 24 4
gpt4 key购买 nike

我刚刚在一台新机器上创建了一个工作区,从 TFS 获得了我们项目的最新信息,启用了 NuGet 还原,我得到了以下(略读)输出:

1>------ Rebuild All started: Project: Caching, Configuration: Debug Any CPU ------
1> Restoring NuGet packages...
1> To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
1> All packages listed in packages.config are already installed.
1> Caching Framework -> C:\MyProjLocation\Caching\bin\Debug\Caching.dll
2>------ Rebuild All started: Project: Library, Configuration: Debug Any CPU ------
2>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "LumenWorks.Framework.IO". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
2>C:\MyProjLocation\Library\SomeClass.cs(2,7,2,17): error CS0246: The type or namespace name 'LumenWorks' could not be found (are you missing a using directive or an assembly reference?)

========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========

没有还原任何 NuGet 包(有超过 10 个 - 为了便于阅读,我从上面的输出中删除了它们)。

看起来 NuGet 甚至没有尝试恢复第二个项目(库)的包。

我已经尝试在 Library.csproj 中将 NuGet 目标导入移动到 CSharp 目标导入下方。文件, as mentioned here ,但它仍然无法正常工作:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />

我在 Visual Studio 2013 上运行最新版本的 NuGet (2.7.41101.371)。

编辑: packages.config存在并且 NuGet 包管理器使用正确的包勾选了库项目。

最佳答案

您是否也从磁盘中删除了 NuGet.targets 文件?
如果 NuGet.targets 文件存在,Visual Studio/NuGet.exe 将尝试执行 MSBuild 包还原。
this doc了解更多信息。

关于visual-studio - NuGet 不会在构建时恢复包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20761322/

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