Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 910
g.pickardou Avatar asked Jun 19 '15 08:06

g.pickardou


People also ask

How do I clear NuGet local cache?

Open Visual Studio, go to Tools -> NuGet Package Manager -> Package Manager Settings menu. Click Clear All NuGet Cache(s) button in options dialog then clearing process is started. Once NuGet cache location is cleared, click ok button.

Where is the NuGet cache?

C:\Users\[UserName]\. nuget\packages (do contain AspNetCore packages)

What is NuGet command line?

The NuGet Command Line Interface (CLI), nuget.exe , provides the full extent of NuGet functionality to install, create, publish, and manage packages without making any changes to project files.

How do I uninstall NuGet from command line?

Right-click on Project and select Manage NuGet Packages option. Select the Installed tab from NuGet Package Manager dialog and you can see the installed Syncfusion NuGet packages list by giving the Syncfusion keyword in search. Uninstall the Syncfusion NuGet packages which are not required for the project.


1 Answers

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

like image 65
rm8x Avatar answered Oct 06 '22 08:10

rm8x