Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use NuGet packages on build server/production server without internet?

Background

I have the following components:

  • My local solution (.NET 4.5) which makes use of NuGet packages.
  • A PowerShell build script in my solution that has targets to build, run unit tests, to Web.config transforms, etc.
  • A build server without an internet connection running CruiseControl.NET that calls my build script to build the files. It also serves as the (IIS7) environment for the dev build.
  • A production server with IIS7 that does not have internet access.

Goal

I would like to utilize NuGet packages from my solution and have them be stored locally as part of source -- without having to rely on an internet connection or nuget package server on my build and production servers.

Question

  • How can I tell MSBuild to properly deploy these packages, or is this the default behavior of NuGet?
like image 592
SeanKilleen Avatar asked Nov 26 '12 18:11

SeanKilleen


1 Answers

Scott Hanselman has written an excellent article entitled How to access NuGet when NuGet.org is down (or you're on a plane). If you read through this article, you'll see at the end that the suggestions he makes are primarily temporary-type solutions and he goes out of his way to say that you should never need the offline cache except in those emergency situations.

If you read at the bottom of his article, however, he makes this suggestion:

If you're concerned about external dependencies on a company-wide scale, you might want to have a network share (perhaps on a shared builder server) within your organization that contains the NuGet packages that you rely on. This is a useful thing if you are in a low-bandwidth situation as an organization.

This is what I ended up doing in a similar situation. We have a share which we keep with the latest versions of various packages that we rely on (of course, I'm assuming you're on some type of network). It works great and requires just a little work to update the packages on a semi-regular basis (we have a quarterly update cycle).

Another article that may also be of help to you (was to me) is: Using NuGet to Distribute Our Company Internal DLLs

like image 121
JasCav Avatar answered Nov 04 '22 19:11

JasCav