TeamCity Nuget Installer step fails saying Failed to find NuGet executable

UNG picture UNG · Oct 12, 2016 · Viewed 8.3k times · Source

I have created a TeamCity buils step using Nuget Installer, but when I run the steps I get the error :

Updating sources: server side checkout
[15:35:44][Updating sources] Repository sources transferred: 112.73 KB total
[15:35:44][Updating sources] Removing C:\TeamCity\buildAgent\work\12dee9c66185ea67
[15:35:44][Updating sources] Updating C:\TeamCity\buildAgent\work\12dee9c66185ea67
[15:35:44]Parameter **"teamcity.tool.NuGet.CommandLine.DEFAULT=%teamcity.tool.NuGet.CommandLine.3.4.3%" is not fully resolved, using as is.**

Step 1/3: Nuget (NuGet Installer)
[15:25:34][Step 1/3] scan: Searching for nuget.config files
[15:25:34][scan] Found packages folder: C:\TeamCity\buildAgent\work\12dee9c66185ea67\packages
[15:25:34][scan] Failed to find repositories.config at C:\TeamCity\buildAgent\work\12dee9c66185ea67\packages\repositories.config
[15:25:34][scan] Scanning projects in solution file: C:\TeamCity\buildAgent\work\12dee9c66185ea67\Specflow.sln
[15:25:34][scan] Found project C:\TeamCity\buildAgent\work\12dee9c66185ea67\Specflow\Specflow.csproj
**[15:25:34][Step 1/3] Failed to find NuGet executable at: C:\TeamCity\buildAgent\work\12dee9c66185ea67\%teamcity.tool.NuGet.CommandLine.DEFAULT%
[15:25:34][Step 1/3] Step Nuget (NuGet Installer) failed with unexpected error**

But I have downloaded the Nuget.exe below are the screenshots: enter image description here

Not sure what am I missing? Any help is much appreciated! Thank you.

Answer

UNG picture UNG · Oct 12, 2016

So after breaking my head over this, I managed to find the solution.

At the time of downloading nuget.exe in Teamcity - Administrator>Integration>Tools>Nuget.exe>Installed Version>3.4.3

if teamcity agent is already running & you try to run a new build, the agent can never detect new installations(in this case nuget.exe) and so it fails.

Solution - restart the agent ->in command prompt C:\TeamCity\buildAgent\bin>agent.bat stop force and then C:\TeamCity\buildAgent\bin>agent.bat start.

Now go to Administration>>Project_name>Build Steps>Parameters

  • Add a new Parameter
  • Configuration Parameters
  • Name : teamcity.tool.NuGet.CommandLine.DEFAULT
  • Value: Browse the small box and select- %teamcity.tool.NuGet.CommandLine.3.4.3%
  • Save

Run the Build

The Nuget Installer Step runs fine and restores the packages.