Safe to Delete

NuGet Global Packages Cache Folder (~/.nuget/packages)

Quick Answer: The ~/.nuget/packages folder caches downloaded C# and .NET NuGet packages. Clearing it via dotnet nuget locals all --clear is safe.

Bottom Line: It is 100% safe to clear the NuGet global packages cache. Running dotnet nuget locals all --clear will not delete your C# code or Visual Studio project solutions.


What is the NuGet Packages Cache Folder?

Located at ~/.nuget/packages on macOS/Linux or %USERPROFILE%\.nuget\packages on Windows, this directory is created by NuGet (the package manager for .NET, C#, F#, and ASP.NET Core).

When you build .NET applications, Visual Studio or the dotnet CLI downloads required NuGet package dependencies (.nupkg) into this global cache. Like Maven or npm, NuGet never automatically deletes old package versions. Over years of .NET development, obsolete packages hoard 10 GB to 30 GB+.


Can You Delete ~/.nuget/packages?

✅ Yes, it is completely safe to clear.

  • No project code lost: Your source code, .csproj files, and solution files live in your project directories and are untouched.
  • Auto-restored on build: The next time you open a project or run dotnet restore, NuGet will automatically re-download active dependencies.

How to Safely Clean Up NuGet Cache

Open your terminal or command prompt and run:

dotnet nuget locals all --clear

What it does: It safely purges the global packages cache, HTTP cache, and temporary cache folders in one step.

Method 2: Clear via Visual Studio (Windows)

  1. Open Visual Studio.
  2. Go to Tools > NuGet Package Manager > Package Manager Settings.
  3. Under General, click Clear All NuGet Storage.

Discussion

Loading authentication...

Related in developer

The AI Engineer's Model Disk Cleanup Guide: Hugging Face, Ollama & PyTorch

The ultimate 1,200-word field guide for AI developers and local LLM hobbyists to reclaim 200GB+ from Ollama, Hugging Face, PyTorch, and vLLM model weights.

Safe to Delete

Android Studio System Index Cache (AndroidStudio Cache)

Android Studio caches Gradle project indexes, VFS caches, and compiler artifacts. Invalidate and clear is safe.

Safe to Delete

Ansible Automation Temp & Fact Cache (~/.ansible/tmp)

Ansible stores temporary playbook execution modules and target host fact JSON caches in ~/.ansible/tmp. Clearing Ansible tmp is safe.

Safe to Delete
Back to all files