Use local NuGet file repository to use NuGet on a Build Server that has no access to the webs.

Scott Hanselman has blogged about using your local NuGet cache as your private local NuGet server in case your connection is down. And that works great when you're working locally. When working with Team Build you have multiple options, one is to enable Package restore and use Nugetter to have Team Build download the files during build, the other is to check your packages into sourcecontrol.

We had configured Nugetter on our previous build server and on all the local workstations, but a recent change in VPN's, DMZ's and other infrastructure stuff, the Build server has ended up behind a firewall that is blocking outgoing connections... So all our builds started failing.

Since this was going to be fixed again soon, we decided to apply the same trick Scott used to work locally to our build server. One of the developers has copied the local NuGet cache over to the build server and we've added the following item to the MsBuild Commandline Arguments:

/p:PackageSources:d:\NuGetCache

This will instruct NuGetter to look in that location for its packages during the package restore phase.

Now when the internet connection has been restored, removing this line will resume normal operation. Until then we can still build :).