2

I'm suffering from changing default .nuget packages directory.
I want to change default nuget folder because It seems grow bigger and bigger. and It now occupies 5.0 GB in my OS main Drive C.
so, I cut and copied .nuget folder from users\nuget to secondary Hard Drive D.

enter image description here

and then, I think that I did redirect it with solution package management.
below is picture of it.

enter image description here

and below is .xml source of Nuget.Config file in my %AppData%Nuget

<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="Package source" value="D:\.nuget\packages" />
    <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
  </packageSources>
  <config>
    <add key="repositoryPath" value="D:\.nuget\packages" />
  </config>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <packageManagement>
    <add key="format" value="0" />
    <add key="disabled" value="False" />
  </packageManagement>
  <disabledPackageSources>
    <add key="Microsoft Visual Studio Offline Packages" value="true" />
  </disabledPackageSources>
</configuration>

the problem is, when I compiled my UWP Project - just blank UWP.
then It starts to download something. I don't Know how to Stops to download nuget packages.
It appeared again with Users\Nuget 3.0 GB.
enter image description here

How can I stops downloading nuget in C drive user\nuget? and can I set my Visual Studio so that It should find or download nuget packages from or to specific folder?

and Also I don't understand difference between user\nuget and ProgramFiles\Microsoft SDK\NugetPackages. below is picture of them.

enter image description here

can you explain me what is the difference between user\nuget and Programfiles...nugetpacakges..?

Thanks for reading.

Jeong Yo Han
  • 551
  • 4
  • 16
  • 1
    Hi, maybe [this post](https://stackoverflow.com/a/4197201/2590375) helps. Please read the last citation in that answer, starting with 'if you have an existing packages folder underneath your solution root(...)' – nilsK Nov 26 '18 at 16:34
  • @nilSk Thank you. but I don't see that there are some packages folder in my solution folder. the project folder ?, there is no package folder in my solution. Does It may means that each solution(project) has nuget packages set? But, I could solve my problem with changing global packages folder. – Jeong Yo Han Nov 27 '18 at 09:59
  • Never mind ... got myself a bit confused here. Glad you got it working! Sometimes it is simple, thanks @martin ;) – nilsK Nov 27 '18 at 10:16

1 Answers1

3

This is the global packages folder, not repositoryPath. You can configure it via the globalPackagesFolder config property:

<config>
    <add key="globalPackagesFolder" value="D:\.nuget\packages" />
</config>
Martin Ullrich
  • 94,744
  • 25
  • 252
  • 217