4

I use Visual Studio 2022. There I have seen, that it stores the NuGet-Packages-Reference in the csproj-File as PackageReference. Now I am searching for the nupkg-files. Where are they stored in Visual Studio 2022? I didn't find them.

BennoDual
  • 5,865
  • 15
  • 67
  • 153

2 Answers2

5

There are several locations where the nuget files are stored and/or decompressed. You get them with the following command:

dotnet nuget locals -l all

For me, this returns:

C:\projects>dotnet nuget locals -l all
http-cache: C:\Users\PMF\AppData\Local\NuGet\v3-cache
global-packages: C:\Users\PMF\.nuget\packages\
temp: C:\Users\PMF\AppData\Local\Temp\NuGetScratch
plugins-cache: C:\Users\PMF\AppData\Local\NuGet\plugins-cache
PMF
  • 14,535
  • 3
  • 23
  • 49
  • I wonder why Microsoft no longer relies on solution/project level packages folder ? – BaltoStar Aug 15 '22 at 02:00
  • 2
    @BaltoStar Probably mostly to save bandwidth. Many packages are used by many projects, and if you're working with a lot of solutions, downloading them each time wastes bandwidth and disk space. – PMF Aug 15 '22 at 04:52
  • @PFM for me it was c:\users\\[myprofile]\.nuget – Larry Aultman Sep 05 '22 at 18:31
  • @LarryAultman Yea, that's the default for most situations. It's the "global-packages" folder mentioned above. – PMF Sep 05 '22 at 18:58
  • @PMF How you include a `.css ` file in `_Layout.cshtml` with this referencing approach? I have a question [here](https://stackoverflow.com/questions/76673639/visual-studio-2022-v-17-6-5-link-installed-nuget-package-css-file-in-layout) – sTx Jul 12 '23 at 19:41
3

This document might be useful to you: nuget.config reference

The location of the default global packages folder. The default is %userprofile%.nuget\packages (Windows) or ~/.nuget/packages (Mac/Linux).

Peng Ge
  • 239
  • 2
  • 5
  • 1
    I wonder why Microsoft no longer relies on solution/project level packages folder ? – BaltoStar Aug 15 '22 at 02:00
  • @BaltoStar most likely is the size of the project folders when you are working on multiple projects that do the same thing (ie use the same versions of packages) – Paul Farry Jul 06 '23 at 01:12