NuGet package restore failing on build server

Apr 23, 2012 at 3:39 PM

Hi, 

I have a build running on a TFS build server.  My solution is using NuGet Package Restore.

The build fails with the following:

Build started 4/23/2012 3:34:17 PM.Project "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\PaulTest.sln" on node 1 (default targets).ValidateSolutionConfiguration:  Building solution configuration "Debug|Any CPU".Project "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\PaulTest.sln" (1) is building "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\ClassLibrary1.csproj" (2) on node 1 (default targets).RestorePackages:  "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\.nuget\nuget.exe" install "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\packages.config" -source "" -o "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\packages"EXEC : warning : Unable to connect to the remote server [C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\ClassLibrary1.csproj]C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\.nuget\nuget.targets(58,9): error : Unable to find version '2.0.0' of package 'log4net'. [C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\ClassLibrary1.csproj]C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\.nuget\nuget.targets(58,9): error MSB3073: The command ""C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\.nuget\nuget.exe" install "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\packages.config" -source "" -o "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\packages"" exited with code 1. [C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\ClassLibrary1.csproj]Done Building Project "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\ClassLibrary1.csproj" (default targets) -- FAILED.Project "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\PaulTest.sln" (1) is building "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1Tests\ClassLibrary1Tests.csproj" (3) on node 1 (default targets).PrepareForBuild:  Creating directory "obj\Debug\".Done Building Project "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1Tests\ClassLibrary1Tests.csproj" (default targets) -- FAILED.Done Building Project "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\PaulTest.sln" (default targets) -- FAILED.
Build FAILED.

So looks like a straightforward one...the build server needs to get to the NuGet feed externally.  Question is, what exactly do I need to get my network guy to open up in the firewall?  How do I find out what NuGet is trying to access?

What's the default used by NuGet?  I see I can add to the <PackageSources> in NuGet.targets, but I'd rather modify as little as possible!

Apr 23, 2012 at 3:47 PM
Try using Fiddler to see what the status of the requests from nuhet.

Sent from my Lumia Windows Phone

From: robinsonpr
Sent: 4/23/2012 8:40 AM
To: Luan Nguyen
Subject: NuGet package restore failing on build server [nuget:353237]

From: robinsonpr

Hi,

I have a build running on a TFS build server. My solution is using NuGet Package Restore.

The build fails with the following:

Build started 4/23/2012 3:34:17 PM.Project "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\PaulTest.sln" on node 1 (default targets).ValidateSolutionConfiguration: Building solution configuration "Debug|Any CPU".Project "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\PaulTest.sln" (1) is building "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\ClassLibrary1.csproj" (2) on node 1 (default targets).RestorePackages: "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\.nuget\nuget.exe" install "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\packages.config" -source "" -o "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\packages"EXEC : warning : Unable to connect to the remote server [C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\ClassLibrary1.csproj]C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\.nuget\nuget.targets(58,9): error : Unable to find version '2.0.0' of package 'log4net'. [C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\ClassLibrary1.csproj]C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\.nuget\nuget.targets(58,9): error MSB3073: The command ""C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\.nuget\nuget.exe" install "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\packages.config" -source "" -o "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\packages"" exited with code 1. [C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\ClassLibrary1.csproj]Done Building Project "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\ClassLibrary1.csproj" (default targets) -- FAILED.Project "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\PaulTest.sln" (1) is building "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1Tests\ClassLibrary1Tests.csproj" (3) on node 1 (default targets).PrepareForBuild: Creating directory "obj\Debug\".Done Building Project "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1Tests\ClassLibrary1Tests.csproj" (default targets) -- FAILED.Done Building Project "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\PaulTest.sln" (default targets) -- FAILED.
Build FAILED.

So looks like a straightforward one...the build server needs to get to the NuGet feed externally. Question is, what exactly do I need to get my network guy to open up in the firewall? How do I find out what NuGet is trying to access?

What's the default used by NuGet? I see I can add to the <PackageSources> in NuGet.targets, but I'd rather modify as little as possible!

Apr 23, 2012 at 4:01 PM

Yes I thought about using fiddler, so tried it on my dev machine.

When I run "nuget.exe install ..." from the command line I don't actually see any activity in fiddler though :(

Apr 23, 2012 at 6:05 PM

what is your full command? Do you configure any package sources?

Apr 24, 2012 at 8:30 AM

It's an out-of-the-box TeamBuild on TFS2010.

I haven't set anything up to specifically do any NuGet commands, I just enabled NuGet Package Restore on the solution.

So this is the failing command on the Build:

"C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\.nuget\nuget.exe" install "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\packages.config" -source "" -o "C:\Builds\4\EnterpriseApplications\PaulTestBuild\Sources\packages"

I then tried setting up a specific PackageSources in the NuGet.targets file in the solution.

I set it to this:

<PackageSources>"http://packages.nuget.org/v1/FeedService.svc/"</PackageSources>

So that got the build to run this command (it added the URL to the -source switch):

"C:\Builds\5\EnterpriseApplications\PaulTestBuild\Sources\.nuget\nuget.exe" install "C:\Builds\5\EnterpriseApplications\PaulTestBuild\Sources\ClassLibrary1\packages.config" -source "http://packages.nuget.org/v1/FeedService.svc/" -o "C:\Builds\5\EnterpriseApplications\PaulTestBuild\Sources\packages"

Unfortunately it still fails saying "unable to connect to the remote server", but l verified that the build server has got access to nuget.org on port 80.

Apr 24, 2012 at 1:05 PM

Could it be because of firewall? Check your firewall configuration.

Apr 24, 2012 at 4:08 PM

As you said in the other thread....probably firewall. I think I just need to get port 443 opened up...