1
votes

I am trying to automate the TFS build process, so that when a dll gets built, it will go to NuGet Server, using TFS 2015.

I updated the nugget exe on TFS agent (C:\Lucky\agent\agent\Worker\Tools)

Now I am getting an error when publishing to local nugget server. I tried so many option but still getting the error.

I am not sure what is going wrong. Also anyone share good step by step process to automate TFS build process with Nuget?

Error

Set workingFolder to default: C:\Lucky\agent\tasks\NuGetPublisher\0.1.41 Executing the powershell script: C:\Lucky\agent\tasks\NuGetPublisher\0.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\2\NuGet\newNuGet.config No Pattern found in solution parameter. Found files: 1 File: C:\Lucky\agent_work\2\s\Dev\TestDLL Invoking nuget with push "C:\Lucky\agent_work\2\s\Dev\TestDLL" -s http://localhost/NuGetLocalSvr/ -configFile "C:\Lucky\agent_work\2\NuGet\newNuGet.config" -apiKey VssSessionKey nuget setapikey {XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX} on C:\Lucky\agent_work\2\s\Dev\TestDLL C:\Lucky\agent\agent\worker\tools\NuGet.exe push "C:\Lucky\agent_work\2\s\Dev\TestDLL" -s http://localhost/NuGetLocalSvr/ -configFile "C:\Lucky\agent_work\2\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

1

1 Answers

0
votes

It's not suggest to update the nuget.exe separately on your build agent. Even though your nuget.exe is using latest version, the task about nuget publish on your build agent is stilling calling the older version. Which maybe the error's root cause.

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.

You could try to update your build agent. Right-click on the agent pool that you want to update. Choose Update All Agents from the context menu. Detail steps please refer this tutorial-- Updating Your Team Foundation Build Agents

Another way is manually downloading the latest version of build agent from GitHub. Install and configure the agent, stop the old agent service, stat the new agent service. After this trigger the build again to see if the error gone.


As for a step by step process to automate TFS build process with Nuget, suggest you refer the official tutorial from 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