0

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
  • 47,577
  • 22
  • 132
  • 150
  • 1
    why you still use the preview version? .NET Core SDK 1.0.4 already has been released and we even have now `.NET Core 2.0 Preview 2`... – Set Jul 10 '17 at 10:56
  • and look into https://stackoverflow.com/questions/43541859/change-nuget-package-folders-used-by-visual-studio-2017 as looks like it contains the answer to your question as well – Set Jul 10 '17 at 11:03
  • VS 2015 by default adds preview version for core. I am trying the above link options and will update. – PraveenLearnsEveryday Jul 10 '17 at 13:09

1 Answers1

0

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.

natemcmaster
  • 25,673
  • 6
  • 78
  • 100