Why would you need to clear your local NuGet cache? Recently I realized that my local NuGet cache was just over 7GB. Yes, gigabytes.
Sponsor: Do you build complex software systems? See how NServiceBus makes it easier to design, build, and manage software systems that use message queues to achieve loose coupling. Get started for free.
I know it's cliche to mention anything about node_modules, but I accidentally deleted it. All 500mb of it. To be fair, my local NuGet cache is 7GB.— Derek Comartin (@codeopinion) October 4, 2018
Local NuGet CacheYou may not even realize that NuGet stores copies of NuGet packages on your machine. There are a couple of places they are stored. If you have the latest .NET Core SDK, you can run:
dotnet nuget locals all --listOr if you have the latest NuGet.exe you can run:
.\nuget.exe locals all -listThe result will show you the locations of where NuGet packages are cached.
Global PackagesIf you check out the location of global-packages, mine was just over 7GB.
ClearingYou can clear these package locations by using:
dotnet nuget locals all --clearor with
.\nuget.exe locals all -clear
HelpYou don’t have to clear all location types (global-packages, http-cache, etc). For more options check out:
dotnet nuget locals --helpor
.\nuget.exe locals -help