There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?

18

Closed

Package Restore ignores nuget.config repositoryPath setting.

description

When manually adding NuGet packages, they are downloaded to the specified directory in nuget.config <repositoryPath> setting. However the package restore functionality ignores this setting and always downloads to \packages.

I wish to checkin only one .nuget folder, as in Item 2003
http://nuget.codeplex.com/workitem/2003?ProjectName=nuget .
So the workaround to change NuGet.targets can only meet one solution's need.
I think it should respect each solution's repositoryPath, or I can define only one repositoryPath for all solutions in one team project.

Actually, you should enable package restore first (instead of creating the nuget.config) and then add the settings to .nuget\nuget.config
(if .nuget folder exists it starts looking for nuget.config from there and then traversing the parent folder hierarchy)
<configuration>
<config>

<add key="repositoryPath" value="..\Dependencies" />

</config>
</configuration>
As stated in the release notes, this is the new way to specify the repositorypath and is inline with the pattern to set a key
Also, you would have to reload the solution in visual studio if you edit the config to change the path after the solution has been loaded.

I believe this is a regression recently introduce in NuGet 2.6.
in 2.5 I setup several of our solutions in VS to automatically manage references through NuGet and restore them when not found (awesome feature for CI and prevent bloating the repository with unnecessary binary files). However, for a few weeks now I noticed
that both, VS2012 and VS2013preview and now RC completely ignore the value set in nuget.config. This is how my nuget.config file looks (under .nuget folder found at the solution directory level)

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>

<add key="repositoryPath" value="..\..\lib\packages" />

</config>
<solution>

<add key="disableSourceControlIntegration" value="true" />

</solution>
</configuration>

I have tried setting the disableSourceControlIntegration value to false, no effect. I have removed that element completely, no effect either. The restore is restoring all of the references managed by Nuget to $(SolutionDir)packages.
I tried to find the variable in NuGet.Targets mentioned in one of the earlier comments, but I don't see where that variable is.
I modified this line instead:
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(SolutionDir)..\lib</PackageOutputDir>