1

I have two machines, my dev machine and the build server. For the latter nuget restore does try to pull a wrong version for a particular package

16:15:48 Failed to retrieve information about 'Autofac' from remote source 'https://nuget.intra/api/nuget/virtual-nuget/FindPackagesById()?id='Autofac'&semVerLevel=2.0.0'.

I've checked the complete solution and there is no rederence to version 2.0.0 but only 4.x.x. More strangely the nuget restore works fine on my dev machien

D:\development\data\svn\MYPROJECT
λ nuget restore
MSBuild auto-detection: using msbuild version '4.8.3761.0 built by: NET48REL1' from 'C:\Windows\Microsoft.NET\Framework\v4.0.30319'.
Restoring NuGet package Autofac.4.9.4.
...
  GET https://nuget.intra/api/nuget/virtual-nuget/Packages(Id='Autofac',Version='4.9.4')
...
  OK https://nuget.intra/api/nuget/virtual-nuget/Packages(Id='Autofac',Version='4.9.4') 31ms
...
  GET https://artifactory.intra/artifactory/api/nuget/virtual-nuget/Download/Autofac/4.9.4
...
  OK https://artifactory.intra/artifactory/api/nuget/virtual-nuget/Download/Autofac/4.9.4 95ms
...
Installing Autofac 4.9.4.
...
Adding package 'Autofac.4.9.4' to folder 'D:\development\data\svn\MYPROJECT\packages'
...
Added package 'Autofac.4.9.4' to folder 'D:\development\data\svn\MYPROJECT\packages'
....
Restoring NuGet package Autofac.4.9.0.
  GET https://nuget.intra/api/nuget/virtual-nuget/Packages(Id='Autofac',Version='4.9.0')
Adding package 'MSTest.TestFramework.1.3.2' to folder 'D:\development\data\svn\MYPROJECT\packages'
  OK https://nuget.intra/api/nuget/virtual-nuget/Packages(Id='Autofac',Version='4.9.0') 37ms
  GET https://artifactory.intra/artifactory/api/nuget/virtual-nuget/Download/Autofac/4.9.0
  OK https://artifactory.intra/artifactory/api/nuget/virtual-nuget/Download/Autofac/4.9.0 10ms
Installing Autofac 4.9.0.
...
Adding package 'Autofac.4.9.0' to folder 'D:\development\data\svn\MYPROJECT\packages'
  GET https://artifactory.intra/artifactory/api/nuget/virtual-nuget/Download/System.Security.Cryptography.Algorithms/4.3.0
...
Added package 'Autofac.4.9.0' to folder 'D:\development\data\svn\MYPROJECT\packages'
...
NuGet Config files used:
    C:\Users\papanito\AppData\Roaming\NuGet\NuGet.Config
    C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
    https://nuget.intra/api/nuget/virtual-nuget
    C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
Installed:
    18 package(s) to packages.config projects

Both have the same nuget version installed with choco install nuget.commandline. I also distribute the same Nuget.Config to both machines.

Update

Further up in the log I can see the following

 Unable to load the service index for source https://nuget.intra/api/nuget/virtual-nuget.
07:43:45   Invalid length for a Base-64 char array or string.

Maybe due to the fact that the index cannot be read the wrong version is downloaded? However, still doesn't explain why on my dev machine all works fine.

Update 2

So there is a Visual Studio 2017 installed on the build server. I've checked various other sources and tried some things, without success.

Checked various files for proxy settings but none of them has one, which is good

  • C:\Windows\syste - m32\config\systemprofile\AppData\Roaming\NuGet\NuGet.Config
  • C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe.config
papanito
  • 2,349
  • 2
  • 32
  • 60

2 Answers2

0

By the error code, it looks to be an issue getting to that NuGet package from your build server.

If you run Fiddler (and configure it to decrypt HTTPS), what's the status code you get when the index file is retrieved from your private NuGet server ?

Below a 200 OK while retrieving the Autofac NuGet package from nuget.org:

enter image description here

Mihai Albert
  • 1,288
  • 1
  • 12
  • 27
0

I appears the issue is related to a wrong NuGetDefaults.config: As soon as there are username and password defined for a source in that file, nuget fails.

papanito
  • 2,349
  • 2
  • 32
  • 60