I would like to know
In C# or VB.NET project should we include the PACKAGE folder (nugget package folder that is created to the root of my project that contain the nupkg files and other content) to our source control repository (Git for instance).
A lot of time has passed, and NuGet has changed, so here's a new answer.
NuGet no longer creates a packages folder inside your source structure. Instead there is one in your user directory (
%HOME%\.nuget\packages to be specific) where it puts all packages it downloads, and projects just reference these.
So the simple answer these days is no, you shouldn't. If you are worried about packages you need disappearing, you should create a local NuGet mirror that you back up separately.
Check out Bart van Ingen Schenau's answer to determine if it's possible to ignore the
packages folder at all.
Basically: yes, NuGet is designed so that you can ignore the
packages folder and NuGet will pull everything from the Internet if it's missing.
But should you ignore it? I say: it depends.
IMO it's a question of "can we continue working in case the package repository is not available" (be it temporarily or permanently)
For my personal OSS projects, I have the
packages folder ignored in all of them.
When nuget.org is offline, I'll just wait and continue another day.
But it's something different at work.
Sure, you probably still have the packages locally on some machine, but is saving some space worth the hassle when your builds are breaking because your build server can't reach nuget.org?
We decided that space is cheap and we don't want the hassle, that's why we're committing the
packages folder to source control.
The basic rule for what goes into a source control repository is that you store there everything related to a project that you need to be able to build, test, deploy and execute the project and which can not be generated from items already present in the repository.
In other words, if you can throw away the PACKAGE folder and its contents without affecting your ability continue working on the project (the build might take longer, but you don't have to hunt down and install anything yourself), then the folder can be safely left out of the repository.
If the folder contains 3rd-party packages that might take a long time to download or that might become unavailable, then that might be a reason to add them to your repository anyway.