Pascal Caffet Pascal Caffet - 1 year ago 218
C# Question

Cake build.ps1 fails to install Cake

We use the standard build.ps1 PowerShell script supplied from

It's worked splendid on both CI and developer machines, but for 1 of our developers we get the following error when launching build.ps1

Unable to find package 'Cake'

And then exits, checking tools folder there's no Cake installed.

Answer Source

The error you're getting is because NuGet console can't find the Cake package among the configured feeds on the machine.

You can test this theory by changing the following line in

$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""


$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`" -Source `"`""

If that works your colleagues machine likely lacks or have the standard feeds disabled on his machine.

You can list which sources you have configured by using the NuGet console like this (if you don't have nuget console in path it should be avail in the repo tools folder)

nuget sources list

It should then list v2 and/or v3 feed for and they should have the text [Enabled] after them like below

Registered Sources:

  1. [Enabled]
  2. [Enabled]

If they're listed but disabled you can enable them by typing

nuget source enable -Name


nuget source enable -Name

Depending on which feed you have registered & disabled, if the sources are missing then you can add them by typing

nuget sources add -Name -Source

Settings are stored in %AppData%\NuGet\NuGet.config so you could manually edit that file, to make sure everyone uses same sources in team you could add a NuGet.config to the root of the repository as nuget tries to find config in path and then falls back to app data.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download