'Prune' extraneous packages from local disk


NuGet's CLI needs a prune command to get rid of extraneous packages on the local disk. When commits are made to packages.config and pushed, the other developers will pull the file and Package Restore will automatically download the new packages. However, it will not remove the old packages that are no longer referenced anywhere in the solution. This causes a lot of extra disk usage.

One primary impact of this (for us) is on Windows Azure Websites. When a Git Deploy is initiated, the installation process will automatically pull the new packages, but will not remove the old packages. This causes a lot of extra disk usage on WAWS, especially given the small quotas on the free tier.

If a project lives for a while, it will go through many package updates, and all of the old versions will stick around on the WAWS repository.

I recommend using the prune command--nuget prune--as this follows the precedent set by Bower and NPM for similar functionality. prune would remove all extraneous packages, including old versions that have been updated and libraries that are not in any way referenced by the solution.


XavierDecoster wrote Mar 17, 2014 at 5:14 PM

I'd even advocate to auto-prune after package restore.