When looking up the location that the NuGet packages are stored we noticed that some of the dlls were stored at C:\Users\Username\.nuget\packages
while others were stored at C:\Program Files\dotnet\sdk\NuGetFallbackFolder
.
For example, the microsoft.aspnetcore.all package folder is present in both directories on my dev pc (C:\Users\Username\.nuget\packages
contains 2.0.7 and 2.1.0, while C:\Program Files\dotnet\sdk\NuGetFallbackFolder
contains 2.0.0, 2.0.3, 2.0.5, 2.0.6 and 2.0.8).
According to the book "C# 7 and .NET Core 2.0 High Performance" by Ovais Mehboob Ahmed Khan. The default path should be C:\Users\Username\.nuget\packages
.
Why are the files separated into the different folders?
Note: We are referencing microsoft.aspnetcore.all version 2.0.8 in most of our projects. Most of the other packages we reference in our projects alternate between the two folders.
.NET Core introduced the concept of Nuget caching (a bit similar to GAC). All packages downloaded only once to a specific folder and reused for all projects. It is needed because of .NET Core 2.x-3.x now composed from hundreds of packages. So the framework now is very granular you use what you need. This created a now type of issue the Nuget Hell (used to we had DLL Hell). To make developers life easier MS introduced "aggregating" packages e.g. microsoft.aspnetcore.all (which contains nothing just references everything but actually if you do self contained build it will include only what you are using not all DLLs).
As you mentioned now you can find installed Nuget packages under you User account e.g.: C:\Users\< your userName >.nuget\packages.
According to this documentation you can run this command which will list all Nuget folders on your machine:
dotnet nuget locals all -l
The result will be something like this (folder names self are explanatory):
C:\Users\...>dotnet nuget locals all -l
info : http-cache: C:\Users\...\AppData\Local\NuGet\v3-cache
info : global-packages: C:\Users\...\.nuget\packages\
info : temp: C:\Users\...\AppData\Local\Temp\NuGetScratch
info : plugins-cache: C:\Users\...\AppData\Local\NuGet\plugins-cache
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With