I'm having troubles with NuGet package restoring during a TFS Build 2015.
Since some packages require NuGet 3.x client, I've configured the new scriptable build to use a custom NuGet location where I've placed the executable of NuGet Command-Line 3.x beta.
Whenever I run a build, all packages can't be restored and NuGet throws the "Unable to find version..." error:
Unable to find version '1.1.10' of package 'Microsoft.Bcl'.
Unable to find version '4.0.10' of package 'System.Threading'.
Unable to find version '1.1.37' of package 'System.Collections.Immutable'.
Unable to find version '1.0.0' of package 'Owin'.
Unable to find version '4.1.0' of package 'NLog'.
Unable to find version '7.0.1' of package 'Newtonsoft.Json'.
Unable to find version '2.0.1' of package 'MongoDB.Driver.Core'.
Unable to find version '2.0.1' of package 'MongoDB.Driver'.
Unable to find version '2.0.1' of package 'MongoDB.Bson'.
Unable to find version '3.0.1' of package 'Microsoft.Owin.Security.OAuth'.
...and even more packages. I believe the issue is clear.
When I build the same solution in the build machine using Visual Studio, all packages are restored sucessfully.
How do I solve this?
In my case the
Nuget.Config
, was in:So search for
Nuget.Config
in yourC:\
.The user depends on the account that you configured the
Agent
In my case, the issue was that user-wide
NuGet.config
located atC:\Users\[User name]\AppData\Roaming\NuGet\NuGet.config
(where[User name]
is the user who's running the build agent's Windows service) was pointing to NuGet API v2 while my build is already using NuGet Command-Line 3.x.If for some reason updating the
NuGet.config
in the Roaming folder is not an option or unwanted, it is also possible to add the config file to the solution root.According to the docs:
Config file locations and uses