4

In our existing solution we have a NuGet.Config file with the following content:

<?xml version="1.0" encoding="utf-8"?> 
<configuration>   
    <solution>
        <add key="disableSourceControlIntegration" value="true" />           
    </solution>
    <config>
        <add key="repositorypath" value="NuGetPackages" />
    </config> 
</configuration>

With this config we tell NuGet to store all packages in the "NuGetPackages" folder. This works fine for all our existing Projects (WebApi, Libraries, ...), but if I add a new ASP.NET Core project, the packages are stored in the C:\Users\<username>\.dnx\packages folder.

Is there a way to change the package folder on solution level?

Thanks!!

Martin Schagerl
  • 583
  • 1
  • 7
  • 19

2 Answers2

3

Yeah, you can use the global.json for that:

{
  "packages": "NuGetPackages",
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-rc1-update1"
  }
}

See: https://github.com/aspnet/Home/wiki/Package-Locations

Axel Heer
  • 1,863
  • 16
  • 22
0

You might need to use globalPackagesFolder instead of repositoryPath key as stated in NuGet documentation:

Note: dependencyVersion and repositoryPath apply only to projects using packages.config. globalPackagesFolder applies only to projects using project.json and projects using the new Visual Studio 2017 project format.

Lanorkin
  • 7,310
  • 2
  • 42
  • 60