How can I clear the NuGet package cache using the command line?

g.pickardou picture g.pickardou · Jun 19, 2015 · Viewed 242.9k times · Source

I can clear my development computer's NuGet package cache using Visual Studio menu ToolsOptionsNuGet Package ManagerGeneral: Clear Package Cache button.

I would like to do this on the command line. Unfortunately, I can not find a related command line switch for nuget.exe.

Did I miss something?

Answer

rm8x picture rm8x · Jan 21, 2016

First, download the NuGet command line tool from here.

Next, open a command prompt and cd to the directory to which nuget.exe was downloaded.

You can list the local caches with this command:

nuget locals all -list

You can clear all caches with this command:

nuget locals all -clear

Reference: https://docs.nuget.org/consume/command-line-reference