3
votes

I am trying to change the location of the default package folder for NuGet

I read many posts including the documentation of the NuGet 2.1 Release Notes, the new config for NuGet version 2.1 as the following:

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

I also read the following thread, Is it possible to change the location of packages for NuGet?

But this configuration doesn't work?

The only config work is the old one which is as the following:

<settings>
  <repositoryPath>C:\myteam\teampackages</repositoryPath>
</settings>

I am using Visual Studio 2012 Update 1 that including NuGet Package version 2.1

Steps to reproduce:

  • in solution directory, create a file "nuget.config"
  • edit nuget.config and add:

<settings>
<repositoryPath>C:\myteam\teampackages</repositoryPath>
</settings>

  • Delete the default packages folder

  • In visual studio, right-click on Solution, and select Manage NuGet Packages Install a package (any package)

  • Verify that package was downloaded to C:\myteam\teampackages

  • delete the downloaded package in C:\myteam\teampackages

  • change the nuget.config to the following:

<configuration>
<config>
<add key="repositoryPath" value="C:\myteam\teampackages" />
</config>
</configuration>

Try to install any library again.

I find the library installed in the packages folder not my folder???

2
Did you try reloading the solution (close and re-open) after adding the nuget.config with the 2.1 release note settings?Deepak
Yes, I even restart the Visual Studio?Mohamed.Radwan -MVP

2 Answers

4
votes

>>steps to reproduce:

>>in solution directory, create a file "nuget.config" From the release notes it looks for nuget.config in the following order .nuget\nuget.config Recursive walk from project (.nuget) folder to root Global nuget.config (%appdata%\NuGet\nuget.config)

So if nuget.config is in the project/solution folder it won't be honored. Can you try moving it to .nuget folder and reload the solution.

2
votes

It works when you place a \ at the end of the path:

<add key=" repositoryPath" value="C:\myteam\teampackages\" />