Keith Walton
Keith Walton

Reputation: 5364

TFS build unable to find some NuGet package versions

The packages restore fine on the developer PC and using Visual Studio on the build server. When performing an automated build using TFS, however, many of the packages fail with a messages like these:

WARNING: Unable to find version '5.0.4' of package 'Newtonsoft.Json'.
WARNING: Unable to find version '1.2.2' of package 'Microsoft.Net.Compilers'.

Other packages work fine:

Added package 'WebGrease.1.5.2' to folder 'E:\d\w\50\s\NHXS.Web.RemittanceManager\packages'

I tried using -verbosity detailed to get more information, but it didn't help. I know some people have had success by updating the NuGet config to use version 3 of the NuGet API, but given that some of the packages work - it seems like this wouldn't be the issue. (And I don't want to break a production build server for other users). Is there a way to get more information on the failures?

Upvotes: 1

Views: 4457

Answers (2)

JDBennett
JDBennett

Reputation: 1505

This helped me out but I chose to go a different route.

I didn't want to mess with the Nuget.config on our TFS server. Instead I checked in a more recent version of the nuget.exe command line in the solution and adjusted the path to the local copy.

enter image description here

Upvotes: 1

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51183

Possible duplicate with this question: "Unable to find version" during TFS Build 2015 when restoring NuGet packages

Please check your nuget install task in your tfs build definition. If you already use V3.0 and the config file are still point to V2.0. You will get this error.

enter image description here

Moreover, since the packages can be restored successfully on you dev PC, you can also compare the nuget.config file on your TFS server and dev PCs to see if there is any difference between them. The nuget.config file locates at "%APPDATA%\NuGet\NuGet.Config".

Upvotes: 1

Related Questions