Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

422
Views
Changing default location of NuGet package download by dotnet CLI

For a C# Console application in VS2019 I issued the following command from .NET CLI (Developer PowerShell):-

 dotnet add package <PackageName> --version <Version>

Then from Object Browser I discovered that the package assembly (.dll) has been copied into my local path starting with C:\Users<userid>.nuget\packages<PackageName><Version>. But if I see my project definition (.csproj file) I only see package name and not the path:-

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="<PackageName>" Version="<Version>" />
  </ItemGroup>

</Project>

Where is the setting in Visual Studio (or .dotnet CLI) that decides which local path NuGet packages should get downloaded to ?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

This is the global NuGet cache, it's configurable (as per the quoted docs below) but yours is the default location

https://www.github.com/NuGet/docs.microsoft.com-nuget/tree/main/docs%2Fconsume-packages%2Fmanaging-the-global-packages-and-cache-folders.md

The global-packages folder is where NuGet installs any downloaded package. Each package is fully expanded into a subfolder that matches the package identifier and version number. Projects using the PackageReference format always use packages directly from this folder. When using the packages.config, packages are installed to the global-packages folder, then copied into the project's packages folder.

Windows: %userprofile%.nuget\packages

Mac/Linux: ~/.nuget/packages

Override using 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). The environment variable takes precedence over the configuration setting.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!