How to clear nuget cache to get updated files on local

By | July 1, 2020

Clearing the nuget cache

Many times we face wired problem like nuget packages are not getting updated locally, even after we take latest code and build or rebuild [or even clean and build] the solution properly. Then also latest nuget packages are not getting downloaded on local folder and we get some errors.

Solution 1: Clear the Nuget cache using command prompt.

  1. Download nuget package command line tool from this link.
  2. Open Command promt and go to the directory where nuget.exe was downloaded.

Now you can see the list of local nuget caches using below command,

nuget locals all -list

Clearing the nuget cache

Clearing the nuget cache

Now type following commands to clear the cache,

nuget locals all -clear

It will clear all the local caches. Now build the solution.

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

Solution 2 –  how to clear nuget cache though visual studio 

Open visual studio, go to tools -> Nuget package manager -> Nuget package manager settings and then click on

Clear all nuget cache(s)

Clearing the nuget cache

Clearing the nuget cache