简体   繁体   中英

Nuget packages folder issue with ASP.Net Core Web App (.Net Framework)

I have a Asp.Net Core Web App(.Net Framework).I am using VS 2015.

global.json

{  
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-preview2-003131"
  }
}

Problem By default, all the nuget packages are referring to the default location C:\\Users\\XXX\\.nuget\\packages .

It builds fine though I want to change this folder location to "C:\\packages". This is what I have tried so far.

  1. adding "packages" : "C:\\packages" in global.json. -- did not work. rather build fails and packages are not resolved.

  2. Adding nuget.config and setting the repository path.

    .\\packages -- It did not work. packages are being restored in the default location only.

Set the environment variable NUGET_PACKAGES

$env:NUGET_PACKAGES='c:\packages'

To make this work with VS, you will need to set in system settings or in your user profile. This will require restarting VS and you may need to logout/login for it to take effect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM