wonderful world
wonderful world

Reputation: 11599

Install nuget package to a custom folder

I have created an ASP.NET 5 app in Visual Studio Community Edition. Then I tried to install the nugget package angularjs.TypeScript.DefinitelyTyped using the command Install-Package angularjs.TypeScript.DefinitelyTyped as well as through the NuGet Package Manager. Both these commands dropped the package in the C:\Users\john\.dnx\packages folder.

I changed the repositoryPath in the nuget.config. Still the packages are saved in the same folders and not under the project.

How can I save the nuget packages under the project and not under c:\users.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <!--To inherit the global NuGet package sources remove the <clear/> line below -->
    <clear />
    <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
  <config>
    <add key="repositoryPath" value="C:\Projects\HelloWorld\src\Scripts"/>
  </config>
</configuration>

This is where the packages are dropped.

C:\Users\john\.dnx\packages\angularjs.TypeScript.DefinitelyTyped\4.2.8

But I want it under C:\Projects\HelloWorld\src

Upvotes: 0

Views: 1082

Answers (1)

Thomas
Thomas

Reputation: 5270

This is part of the not very well documented global.json. This global.json file creates a packages sub dir relative to it, where all the nuget packages end up when you restore them.

{
    "packages": "packages",
    "sdk": {
        "version": "1.0.0-beta8",
        "runtime": "coreclr",
        "architecture": "x64"
    }
}

Upvotes: 1

Related Questions