Martin Schagerl
Martin Schagerl

Reputation: 613

Nuget Configuration in ASP.NET Core 1.0

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!!

Upvotes: 4

Views: 2871

Answers (2)

Lanorkin
Lanorkin

Reputation: 7504

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.

Upvotes: 0

Axel Heer
Axel Heer

Reputation: 1883

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

Upvotes: 3

Related Questions