how to specify a custom location for the packages folder

Topics: General
May 25, 2012 at 1:12 PM

All --

Please help.

I need to know how to how to specify a custom location for the packages folder.

I do not want the "packages" folder in the project.

I do not want the "packages" folder at the "Solution" level.

I want the packages folder somewhere else.

How can one specify the exact custom location of the packages folder for a given project?

Please advise.

Thanks.

-- Mark Kamoski

Developer
May 25, 2012 at 4:05 PM

There's an undocumented\unsupported feature to specify a location for the packages directory. Stick a nuget.config file in your solution root:

<settings>

    <repositoryPath>YOUR PATH HERE</repositoryPath>

</settings>

May 29, 2012 at 11:30 PM

If you add a nuget.config in your solution root, will you have to duplicate all the settings in your %APPDATA%\NuGet\NuGet.config?  Or are those settings inherited?

Thanks,
--John

Jun 1, 2012 at 8:20 PM
pranavkm wrote:

There's an undocumented\unsupported feature to specify a location for the packages directory. Stick a nuget.config file in your solution root:

<settings>

    <repositoryPath>YOUR PATH HERE</repositoryPath>

</settings>

This worked great for us.

Thanks.

-- Mark Kamoski

Jun 22, 2012 at 4:18 PM

The only issue with this is where you have multiple solutions and each has at least one shared project which has Nuget references.  i.e.

Solution1
  -ProjA
  -ProjB

Solution2
  -ProjB
  -ProjC

Now consider these to be two seperate modules and my build server checks out the stuff it needs for Solution1 and Solution2 seperately, the shared repositories.config file is going to have references to the packages.config files for both ProjA and ProjB, whereas when building Solution1, the Solution2 exclusive stuff won't be downloaded to the workspace...

Not sure if that makes sense...