There is no more packages
solution folder in any csproj
or project.json
-based .NET Core project.
NuGet CLI gets the list of used cache folders:
nuget locals all -list
Response:
http-cache: C:\Users\<foo>\AppData\Local\NuGet\v3-cache
global-packages: C:\Users\<foo>\.nuget\packages\
temp: C:\Users\<foo>\AppData\Local\Temp\NuGetScratch
How to change or override these locations?
UPD 2024: standalone nuget
commands replaced with dotnet nuget
CLI. The information provided is relevant for VS2022 and .NET 8.
Solution-local packages folders are no longer used by .NET Core and Visual Studio. The command to list user-specific folders is:
dotnet nuget locals all --list
And its typical output (I've replaced absolute paths with variables and prettified it):
global-packages: %USERPROFILE%\.nuget\packages
http-cache: %$LOCAL_APPDATA%\NuGet\v3-cache
temp: %$LOCAL_APPDATA%\Temp\NuGetScratch
plugins-cache: %$LOCAL_APPDATA%\NuGet\plugins-cache
Notice that the machine-wide folder isn't listed there. However, it is defined at Visual Studio settings: Options -> NuGet Package Manager -> Package Sources. By default it is:
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
In Package Sources, you can add/remove as many cache locations as you want.
NuGet.config
files are located here:
%APPDATA%\NuGet\
%ProgramFiles(x86)%\NuGet\Config\
Any NuGet.config
settings can be overriden at many levels (project, solution, user, machine). Read more about NuGet.config
hierarchical priority ordering here: How settings are applied.
For example, globalPackagesFolder
parameter changes a package cache location:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<clear />
<add key="globalPackagesFolder" value="c:\packages" />
</config>
</configuration>