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?
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.
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.
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.
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.
Using NuGet without committing packages to source control
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With