How can I clear the NuGet package cache using the command line?
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
In Visual Studio 2017, go to menu Tools → NuGet Package Manager → Package Manager Settings. You may find out a button, Clear All NuGet Cache(s):
If you are using .NET Core, you may clear the cache with this command, which should work as of .NET Core tools 1.0:
dotnet nuget locals all --clear
The nuget.exe utility doesn't have this feature, but seeing that the NuGet cache is simply a folder on your computer, you can delete the files manually. Just add this to your batch file:
del %LOCALAPPDATA%\NuGet\Cache\*.nupkg /q
For me I had to go in here:
%userprofile%\.nuget\packages