One of the improvements that were introduced to NuGet a few years ago was the introduction of a global package cache. Instead of having a copy of every nuget package inside your project folder, all nuget packages are downloaded and stored once on a central location on your file system. Each package is fully expanded into a subfolder that matches the package identifier and version number.
By default these packages are stored at the following location:
- Windows:
%userprofile%\.nuget\packages
- Mac/Linux:
~/.nuget/packages
You can override this by setting the NUGET_PACKAGES environment variable, the
globalPackagesFolder
or repositoryPath
configuration settings (when using PackageReference and packages.config
, respectively), or the RestorePackagesPath
MSBuild property (MSBuild only).
Remark: The environment variable takes precedence over the configuration setting.