Is it possible to change the location of packages for NuGet?

It’s now possible to control which folder the packages are installed into.

http://nuget.codeplex.com/workitem/215

Edit:
See Phil Haack’s comment on Dec 10 2010 at 11:45 PM (in the work item/the link above). The support is partially implemented in 1.0, but is not documented.

According to @dfowler:
Add a nuget.config file next to the solution with this:

<settings>
<repositoryPath>{some path here}</repositoryPath>
</settings>

There is a nuget package for creating the package folder override.

Update for version 2.1

As Azat commented, there is now official documentation on how to control the package locations. The release notes for 2.1 specifies the following configuration in a nuget.config file (see the release notes for a description of valid places to put the config files and how the hierarchical configuration model works):

<configuration>
  <config>
    <add key="repositoryPath" value="C:\thePathToMyPackagesFolder" />
  </config>
  ... 
</configuration>

This would change the packages folder for the configuration level you put the file in (solution if you put it in the solution directory, project in project directory and so on). Note that the release notes state:

[…] if you have an existing packages folder underneath your solution
root, you will need to delete it before NuGet will place packages in
the new location.

Leave a Comment