NuGet Restore未能看到未安装软件包

时间:2015-04-16 20:08:33

标签: visual-studio nuget bamboo

我们的CI服务器在尝试构建项目时无法恢复我们的NuGet包。它认为它们已经安装好了。这是日志:

build 16-Apr-2015 12:56:38 C:\build-dir\IOP-IOL-JOB1>nuget restore IOHandlerLibrary.sln -NoCache build 16-Apr-2015 12:56:39 All packages listed in packages.config are already installed.

是什么原因导致NuGet相信软件包已安装?它是解决方案还是项目文件中的内容?

2 个答案:

答案 0 :(得分:2)

我有同样的问题。

当我为sln运行nuget restore时:

> nuget restore MySolution.sln
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files 
(x86)\MSBuild\14.0\bin'.
All packages listed in packages.config are already installed.

当我为解决方案中的每个项目分别运行还原命令时:

> nuget restore MySolution.Common\packages.config -PackagesDirectory .\packages
Restoring NuGet package Microsoft.Azure.KeyVault.WebKey.3.0.0.
Restoring NuGet package Microsoft.Rest.ClientRuntime.2.3.13.
Restoring NuGet package Microsoft.Azure.KeyVault.3.0.0.
Restoring NuGet package Microsoft.Rest.ClientRuntime.Azure.3.3.15.
Restoring NuGet package NLog.4.5.9.
Restoring NuGet package Autofac.4.8.1.
Restoring NuGet package Microsoft.WindowsAzure.ConfigurationManager.3.2.3.
Restoring NuGet package System.IO.4.3.0.
....

所有参考均已返回,此后解决方案将正确构建。 似乎是一个Nuget错误。

答案 1 :(得分:0)

NuGet将在恢复时检查包目录中的解决方案。

检查此packages目录是否包含NuGet包的.nupkg和manifest文件,如果是,则认为NuGet包已在本地安装。

该消息表明软件包已在解决方案包目录中可用。可能是因为您的构建服务器在检出源代码时没有清理现有目录,并且每次都将源代码签出到同一目录。