11

Visual Studio 2015 ignores my nuget.config that lies in the solution directory. This file has the following content:

<?xml version="1.0" encoding="utf-8"?>
<settings>
  <repositoryPath>../packages/nuget</repositoryPath>
</settings>

Visual Studio however simply puts all packages into the packages folder in the solution directory.

This file has worked fine for years when using Visual Studio 2013. Am I missing something?

I am using the latest version of the NuGet extension (3.2)

Daniel Hilgarth
  • 171,043
  • 40
  • 335
  • 443

1 Answers1

13

Looks like the format I used so far is no longer supported.

The following file works:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <config>
    <add key="repositoryPath" value="..\packages\nuget" />
  </config>
</configuration>
Daniel Hilgarth
  • 171,043
  • 40
  • 335
  • 443
  • I wonder whether this new format is backward compatible with VS2013. Going to try tomorrow. – MarcusUA Jan 12 '16 at 18:37
  • 1
    Yes, it does. As far as I can tell, this format has been available for years. – Daniel Hilgarth Jan 14 '16 at 12:57
  • 7
    I added a nuget.config file to my solution and it did not work at first. I had to restart visual studio, and then it worked. – BryanJ May 20 '16 at 17:09
  • This solution helped me a lot. Thanks a lot for the help :) – santosh kumar patro Mar 24 '17 at 14:22
  • The value for repositoryPath will not accept $(SolutionDir) as part of a relative path. But the value can contain environment variables, e.g. %WORKING_COPY_TRUNK%\_packages". For a relative path see https://stackoverflow.com/questions/18376313/setting-up-a-common-nuget-packages-folder-for-all-solutions-when-some-projects-a?rq=1 – MikeOnline Aug 11 '20 at 20:10