NuGet不还原构建中的软件包 [英] NuGet not restoring packages on build

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

问题描述

我刚刚在新计算机上创建了一个工作区,从TFS获取了我们项目的最新信息,启用了NuGet Restore,并且得到了以下(略过的)输出:

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:\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个-为便于阅读,我从上述输出中将其删除了.)

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文件

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)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.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软件包管理器已在Library项目中勾选了正确的软件包.

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.tagets文件,Visual Studio/NuGet.exe将尝试执行MSBuild程序包还原.

If the NuGet.tagets 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天全站免登陆