Skip to content

Clearing Local NuGet Cache

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.

Learn more about Software Architecture & Design.
Join thousands of developers getting weekly updates to increase your understanding of software architecture and design concepts.


Local NuGet CacheWhy would you need to clear your local NuGet cache?  Recently I realized that my local NuGet cache was just over 7GB.  Yes, gigabytes.

Local NuGet Cache

You 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 --list  Or if you have the latest NuGet.exe you can run: .\nuget.exe locals all -list The result will show you the locations of where NuGet packages are cached.

Global Packages

If you check out the location of global-packages, mine was just over 7GB.

Clearing

You can clear these package locations by using: dotnet nuget locals all --clear or with .\nuget.exe locals all -clear

Help

You don’t have to clear all location types (global-packages, http-cache, etc).  For more options check out: dotnet nuget locals --help or .\nuget.exe locals -help

Thanks Oren Novotny!

Thanks go out to Oren Novotny for pointing out this functionality.  Have you been using this already?  Let me know on Twitter or in the comments.

Learn more about Software Architecture & Design.
Join thousands of developers getting weekly updates to increase your understanding of software architecture and design concepts.


Leave a Reply

Your email address will not be published. Required fields are marked *