1

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?

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
Keith Walton
  • 5,211
  • 6
  • 39
  • 53
  • Why you think change Nuget API version2 to version3 will break this production build server ? I'm not sure if version3 is fully backward compatible with version2. But generally speak, this should not be a problem. – PatrickLu-MSFT Sep 20 '16 at 09:47
  • In the verbosity you will find the following lines: NuGet Config files used: C:\Users\tfs\AppData\Roaming\NuGet\NuGet.Config Feeds used: C:\Users\tfs\AppData\Local\NuGet\Cache C:\Users\tfs\.nuget\packages\ https://api.nuget.org/v3/index.json Are you sure WebGrease.1.5.2 isn't in the cache while the other's aren't? Could someone possibly checked in a different NuGet.Config somewhere in the path of the solution that override the default NuGet.config? – Totem Sep 22 '16 at 11:53
  • What is the package source in your nuget.config file? – Eddie Chen - MSFT Sep 26 '16 at 08:00

2 Answers2

1

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".

Community
  • 1
  • 1
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
1

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

JDBennett
  • 1,323
  • 17
  • 45