Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I specify the directory where NuGet packages are installed?

Tags:

How to do to specify the directory where I want install package? Because I need install packages in a project where others devs work and when they do download of the project they need have all packages in your pc.

like image 528
Diego Dias Avatar asked Oct 06 '11 15:10

Diego Dias


People also ask

How do I change the default location of a NuGet package?

Open %AppData%\NuGet folder, open existing NuGet. Config file. Edit repositoryPath key and set new destination.

Where is NuGet Global Packages folder?

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.

How do I change NuGet location in Visual Studio 2019?

Depending on what sort of project you are using this setting may or may not be successfully to change NuGet packager folder. If you are using a . NET Framework project that has a packages. config file then this setting will change the nuget package folder to C:\projects\ .


2 Answers

Use -OutputDirectory.

From NuGet CLI reference.

like image 68
Geri Borbás Avatar answered Sep 20 '22 18:09

Geri Borbás


The packages go in $(SolutionDir)\packages. You have two options:

  1. Check the packages folder into source control
  2. Use NuGetPowerTools so that developer machines will automatically fetch the packages when you build
    • Type "Install-Package NuGetPowerTools" in the Package Manager Console
    • Type "Enable-PackageRestore" in the Package Manager Console
      • This adds a $(SolutionDir).nuget folder, which contains an MSBuild target that will fetch the packages when they're required (eg. if you build on a machine that doesn't already have them). You must check the .nuget folder, and associated csproj changes into source control!!

I'd recommend not checking the packages folder in, since binary files in DVCS make for slow clones :-( In the next version of NuGet, you won't need NuGetPowerTools to avoid checking it in :-)

like image 35
Danny Tuppeny Avatar answered Sep 23 '22 18:09

Danny Tuppeny