NuGet: should you check-in packages into source control?

Interesting discussion at http://nuget.codeplex.com/discussions/230110 about checking in NuGet packages into source control.

NuGet packages can contain more than a simple libraries, it can contain tools that grow quite big as well. Good example in the NUnit package that contains the total NUnit toolset.

Do you want all your binaries into source control, it is already preserved in the NuGet feed. You can always reload the packages from the feed. The required packages in a project are available in the packages.config file that is part of your project and checked into source control.

But what if a package is removed from the feed by the author? That would be bad… on the other hand: in this case shouldn’t you remove a dependency on that package anyway?

What about a build server not connected to the internet and not being able to get packages from the NuGet feed?

After reading the discussion I think I would prefer to not check-in packages into source control…

Just found the following post: https://msmvps.com/blogs/theproblemsolver/archive/2011/04/12/nuget-and-projects-under-source-control.aspx taking the same approach. It describes how you can install all missing packages using the command-line version of nuget.exe with the following command: NuGet install MyProject\packages.config –OutputDirectory Packages

From the documentation:

usage: NuGet install packageId|pathToPackagesConfig [options]

Install a package from a given source. If no source is specified the default feed is used.

     Specify the id and optionally the version of the package to install. If a path to a 
     packages.config file is used instead of an id, all the packages it contains are installed.

options:

Source                     The location to look for packages.
OutputDirectory            Specifies the directory in which packages will be installed
Version                    The version of the package to install.
ExcludeVersion       (x)   If set, the destination folder will contain only the package name, not the version number
Help                 (?)   help

7 Comments

Comments have been disabled for this content.