NuGet 不会在构建时还原包 [英] NuGet not restoring packages on build

查看:23
本文介绍了NuGet 不会在构建时还原包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have just created a workspace on a new machine, got latest of our project from TFS, enabled NuGet Restore, and I get the following (skimmed-down) output:

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:MyProjLocationCachinginDebugCaching.dll
2>------ Rebuild All started: Project: Library, Configuration: Debug Any CPU ------
2>C:Program Files (x86)MSBuild12.0inMicrosoft.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:MyProjLocationLibrarySomeClass.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 个 - 为了便于阅读,我从上面的输出中删除了它们).

None of the NuGet packages were restored (there are over 10 - I removed them from the above output for readability sake).

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

It looks like NuGet is not even trying to restore the packages for the second project (Library).

我已经尝试将 NuGet 目标导入移动到 Library.csproj 文件中的 CSharp 目标导入下方,这里提到,但它仍然无法正常工作:

I have already tried moving the NuGet targets import below the CSharp targets import in the Library.csproj file, as mentioned here, but it's still not working:

<Import Project="$(MSBuildToolsPath)Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir).nugetNuGet.targets" Condition="Exists('$(SolutionDir).nugetNuGet.targets')" />

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

I am running the latest version of NuGet (2.7.41101.371) on Visual Studio 2013.

packages.config 存在,并且 NuGet 包管理器已用正确的包勾选了库项目.

The packages.config exists and the NuGet Package Manager has the Library project ticked with the correct packages.

推荐答案

你是否也从磁盘中删除了 NuGet.targets 文件?

Have you deleted the NuGet.targets file from disk too?

如果有 NuGet.targets 文件,Visual Studio/NuGet.exe 将尝试执行 MSBuild 包还原.

If the NuGet.targets file is there, Visual Studio / NuGet.exe will try to do the MSBuild package restore.

有关详细信息,请参阅此文档.

See this doc for more info.

这篇关于NuGet 不会在构建时还原包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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