0

Recently built a new TFS 2018 (update 3) server and configured package management to use upstream resources, i.e. NuGet.org. One thing I had to do was setup the IIS site to run through a proxy service. Once it was all configured, I set Visual Studio to use TFS as the only package source and cleared the local cache. After I restored the NuGet packages, I verified that TFS was in fact caching them.

I then proceeded to test the server builds. Cleared all the NuGet packages from TFS and local cache and tried to build. The build failed while attempting to retrieve the NuGet packages. As you can see below, the NuGet packages were not found in local cache nor in TFS, so an attempt was made to download the packages from NuGet which failed with a connection refused message.

The nuget command failed with exit code(1) and error(Errors in packages.config projects Unable to find version '1.3.2' of package 'MSTest.TestFramework'. C:\Users\TfsBuild.nuget\packages: Package 'MSTest.TestFramework.1.3.2' is not found on source 'C:\Users\TfsBuild.nuget\packages\'. https://tfs2.somedomain.com/testco/_packaging/be64f838-0b3e-42b4-92cc-bce7c435274a/nuget/v3/index.json: Package 'MSTest.TestFramework.1.3.2' is not found on source 'https://tfs2.somedomain.com/testco/_packaging/be64f838-0b3e-42b4-92cc-bce7c435274a/nuget/v3/index.json'. https://api.nuget.org/v3/index.json: Unable to load the service index for source https://api.nuget.org/v3/index.json. An error occurred while sending the request. Unable to connect to the remote server No connection could be made because the target machine actively refused it 72.21.81.200:443 Unable to find version '1.3.2' of package 'MSTest.TestAdapter'. C:\Users\TfsBuild.nuget\packages: Package 'MSTest.TestAdapter.1.3.2' is not found on source 'C:\Users\TfsBuild.nuget\packages\'. https://tfs2.somedomain.com/testco/_packaging/be64f838-0b3e-42b4-92cc-bce7c435274a/nuget/v3/index.json: Package 'MSTest.TestAdapter.1.3.2' is not found on source 'https://tfs2.somedomain.com/testco/_packaging/be64f838-0b3e-42b4-92cc-bce7c435274a/nuget/v3/index.json'. https://api.nuget.org/v3/index.json: Unable to load the service index for source https://api.nuget.org/v3/index.json. An error occurred while sending the request. Unable to connect to the remote server No connection could be made because the target machine actively refused it 72.21.81.200:443)

My guess is that somehow the build server is bypassing the proxy and attempting to retrieve the NuGet packages directly, but I don't know how. The package source on the build server is the exact same one I used in Visual Studio. Permissions don't seems to be a problem because when the packages exist locally in package management, the build succeeds.

Does anyone have a clue as to why this works from Visual Studio but fails on the build server?

UPDATE

I know where the build is bypassing the upstream feed. There's a check-box that says "Use packages from NuGet.org". When I uncheck this, TFS no longer attempts to go directly to NuGet.org. However, I discovered a new issue. When I setup TFS to use a proxy, the "Use packages from this VSTS/TFS feed" will no longer list my local feed. If I remove the proxy settings, the feed is now listed but the upstream source is broken.

Does anyone know how to configure TFS 2018 behind a proxy so that both upstream package resources can be used along side local package resources in both TFS and Visual Studio?

Community
  • 1
  • 1
Chris Gessler
  • 22,727
  • 7
  • 57
  • 83
  • Is your build server behind a proxy? You can open the source https://api.nuget.org/v3/index.json in the browser on the build server, if you can not open it, it shows you are behind a proxy, you could not access the nuget.org, even if you configured package management to use upstream resources. To resolve this issue, you can try to add proxy settings into Nuget.Config file:https://stackoverflow.com/questions/41185443/nuget-connection-attempt-failed-unable-to-load-the-service-index-for-source – Leo Liu Sep 05 '18 at 07:40
  • @LeoLiu-MSFT - Yes, I'm behind a proxy and can browse to nuget.org. What I need to figure out is the path the build agent is using to connect to nuget.org. It should use the local package source and the package management feature should connect to nuget.org - exactly the same way it's working in Visual Studio. – Chris Gessler Sep 05 '18 at 14:48
  • Have you configured the build agent with --proxyurl switch? I've got similar issues. Did you solve your problem already? – Tom Schardt Sep 26 '18 at 18:35
  • I did not apply a proxy to the build agent, because the build agent does not need to access TFS through a proxy. At least that's how I understand it. At this point, I have not solved the issue and may discontinue use of this feature until it has been resolved by MS. – Chris Gessler Sep 26 '18 at 18:42

0 Answers0