TFS 2015 构建和 Nuget 错误

TFS 2015 Buikd and Nuget Error

我正在尝试自动化 TFS 构建过程,以便在构建 dll 时,它将使用 TFS 2015 转到 NuGet 服务器。

我更新了 TFS 代理上的 nugget exe (C:\Lucky\agent\agent\Worker\Tools)

现在我在发布到本地 nugget 服务器时遇到错误。我尝试了很多选项,但仍然出现错误。

我不确定出了什么问题。还有人分享使用 Nuget 自动化 TFS 构建过程的良好分步过程吗?

错误

Set workingFolder to default: C:\Lucky\agent\tasks\NuGetPublisher[=10=].1.41 Executing the powershell script: C:\Lucky\agent\tasks\NuGetPublisher[=10=].1.41\NuGetPublisher.ps1 Check/Set nuget path Creating Nuget Arguments Getting credentials for Microsoft.TeamFoundation.DistributedTask.Agent.Common.TaskEndpoint Saving to C:\Lucky\agent_work\NuGet\newNuGet.config No Pattern found in solution parameter. Found files: 1 File: C:\Lucky\agent_work\s\Dev\TestDLL Invoking nuget with push "C:\Lucky\agent_work\s\Dev\TestDLL" -s http://localhost/NuGetLocalSvr/ -configFile "C:\Lucky\agent_work\NuGet\newNuGet.config" -apiKey VssSessionKey nuget setapikey {XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX} on C:\Lucky\agent_work\s\Dev\TestDLL C:\Lucky\agent\agent\worker\tools\NuGet.exe push "C:\Lucky\agent_work\s\Dev\TestDLL" -s http://localhost/NuGetLocalSvr/ -configFile "C:\Lucky\agent_work\NuGet\newNuGet.config" -apiKey VssSessionKey nuget setapikey {XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX} Ambiguous option 's'. Possible values: Source SymbolSource SymbolApiKey. Unexpected exit code 1 returned from tool NuGet.exe

不建议在您的构建代理上单独更新 nuget.exe。即使您的 nuget.exe 使用的是最新版本,构建代理上有关 nuget publish 的任务仍在调用旧版本。这可能是错误的根本原因。

NuGet extensions must be used with the exact version of nuget.exe for which they are designed. If you use your own nuget.exe, NuGet extensions included on the build agent may not be compatible and the NuGet build tasks will not load them.

您可以尝试更新您的构建代理。右键单击要更新的代理程序池。从上下文菜单中选择 更新所有代理。详细步骤请参考本教程--Updating Your Team Foundation Build Agents

另一种方法是从 GitHub 手动下载最新版本的构建代理。安装和配置代理,停止旧代理服务,统计新代理服务。在此之后再次触发构建以查看错误是否消失。


关于使用 Nuget 自动构建 TFS 的分步过程,建议您参考 MSDN 的官方教程:Use Team Build to restore and publish NuGet packages

Include three parts:

  • Restore packages at the start of your build
  • Create NuGet packages during your build
  • Publish packages created by your build