Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking in packages from NuGet into version control?

Prior to NuGet, it was common accepted 'best practice' to check-in all external DLLs used on a project. Typically in a Libs or 3rdParty directory.

When working with NuGet, am I supposed to check-in the packages directory, or is there a way for MSBuild to auto download the needed packages from the nuget feed?

like image 853
Scott Weinstein Avatar asked Feb 12 '11 14:02

Scott Weinstein


People also ask

Should I check in NuGet packages?

NuGet packages contain pre-built dlls that are referenced (and copied) during the build process. it is not necessary to check them in, VS can automatically restore packages and nuget.exe restore can download them during a scripted build process.

How do you check NuGet packages?

on the toolbar of the Assembly Explorer window or choose File | Open from NuGet Packages Cache in the main menu . This will open the Open from NuGet Packages Cache dialog. The dialog lists packages from all NuGet cache locations on your machine. Use the search field in the dialog to find the desired package.

How do I add a NuGet package to Git?

Download and install your desired package/library from Nuget. Now before proceeding for checkin you must enable the setting for restoring the missing packages from Visual Studio 2012. This will add the following files in your solution. Finally it'll add the following setting in the Nuget.


1 Answers

No

Since this question was asked there is now an easy workflow to use NuGet without commiting packages to source control

From your package manager console you need to install the 'NuGetPowerTools':

Install-Package NuGetPowerTools 

Then to enable your projects to support pack restore you need to run another command:

Enable-PackageRestore 

Now you are ready to commit your code base without the packages folder. The previous command changed your project files so that if packages are missing they get automatically downloaded and added.

Source

Using NuGet without committing packages to source control

like image 64
Edward Wilde Avatar answered Sep 28 '22 19:09

Edward Wilde