Visual Studio 由于 nuget 导致团队服务构建错误

Visual Studio Team Services build error due to nuget

我对 Visual Studio Team Services 构建和学习过程还很陌生。 我创建了一个解决方案并在 Visual Studio Team Services 上创建了一个构建定义。当我构建它时,我得到了这些日志详细信息,然后是一个错误:

016-06-20T16:34:57.2842078Z Restoring NuGet package log4net.2.0.3.
2016-06-20T16:34:57.2892077Z Restoring NuGet package Microsoft.Azure.WebJobs.1.1.1.
2016-06-20T16:34:57.3452071Z WARNING: Unable to find version '1.1.1' of  package 'Microsoft.Azure.WebJobs'.
2016-06-20T16:34:57.3462075Z   C:\Users\buildguest\AppData\Local\NuGet\Cache: Package 'Microsoft.Azure.WebJobs.1.1.1' is not found on source 'C:\Users\buildguest\AppData\Local\NuGet\Cache'.
2016-06-20T16:34:57.3462075Z WARNING: Unable to find version '2.0.3' of package 'log4net'.
2016-06-20T16:34:57.3472076Z   C:\Users\buildguest\AppData\Local\NuGet\Cache: Package 'log4net.2.0.3' is not found on source 'C:\Users\buildguest\AppData\Local\NuGet\Cache'.
2016-06-20T16:34:57.4162071Z Restoring NuGet package Microsoft.Data.Edm.5.6.2.
2016-06-20T16:34:57.4432070Z WARNING: Unable to find version '5.6.2' of package 'Microsoft.Data.Edm'.
2016-06-20T16:34:57.5062068Z   C:\Users\buildguest\AppData\Local\NuGet\Cache: Package 'Microsoft.Data.Edm.5.6.2' is not found on source 'C:\Users\buildguest\AppData\Local\NuGet\Cache'.

最后的错误:

2016-06-20T16:34:57.9012078Z ##[error]System.Exception: Unexpected exit code 1 returned from tool NuGet.exe
2016-06-20T16:34:57.9022088Z ##[error]   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.PowerShell.InvokeToolCmdlet.ProcessRecord()
2016-06-20T16:34:57.9022088Z ##[error]   at System.Management.Automation.CommandProcessor.ProcessRecord()

当我在本地运行 构建时,nuget 从不报告任何错误。我真的不明白为什么在线版本会抱怨。有人可以帮忙吗?

这是由于 nuget.exe 从 3.3 更新到 3.43 引起的。 MS 正在为此开发修补程序。详情参考这个link:Issues with Hosted Build in Visual Studio Team Services – 6/20 – Investigating.

Update: Monday, 20 June 2016 22:10 UTC

The update to nuget.exe from 3.3 to 3.4.3 has been identified as the root cause of the active restore problems. We are working on a hotfix to restore the previous nuget version on the build agents.

We will update this post as the hotfix progresses.

Sincerely, Sri Harsha

Initial Update: Monday, 20 June 2016 19:40 UTC We are actively investigating issues with the build agents of Visual Studio Team services related to nuget package restore. Some customers may experience Build failures due to nuget packages being restored incorrectly in the Build Agents.

Next Update: Before 22:00 UTC We are actively working to resolve this issue and apologize for any inconvenience.

Sincerely, Manohar