Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet 3.5 / Visual Studio 2015 - Change package cache location

Is it possible to change the nuget package cache path from %UserProfile%\.nuget\packages to a custom location?

I tried using the environment variable NuGetCachePath, but it doesn't seem to work with it.

like image 516
Fionn Avatar asked Aug 04 '16 15:08

Fionn


People also ask

How do I change NuGet package location?

Open %AppData%\NuGet folder, open existing NuGet. Config file. Edit repositoryPath key and set new destination.

How do I move package cache?

Move the package cache One way to do this is by transferring the files to any letter drive or NTFS file system (e.g., another mount, hard disk, USB device, and network drive). You will need to create a junction between the old location and the ​new location.

Where are NuGet packages cache?

NuGet 3.5 and earlier uses packages-cache instead of the http-cache, which is located in %localappdata%\NuGet\Cache . By using the cache and global-packages folders, NuGet generally avoids downloading packages that already exist on the computer, improving the performance of install, update, and restore operations.

Where do NuGet packages get stored locally?

The global-packages folder is where NuGet installs any downloaded package. Each package is fully expanded into a subfolder that matches the package identifier and version number. Projects using the PackageReference format always use packages directly from this folder.


1 Answers

You can modify the location of the package cache by setting an environment variable named NUGET_PACKAGES.

For example, change your location from C:\Users\Frank\.nuget\packages to F:\Users\Frank\.nuget\packages by setting the latter value to a "system" environment variable named NUGET_PACKAGES, and rebooting.

Reference: https://github.com/NuGet/Home/issues/1905

like image 136
NightOwl888 Avatar answered Nov 08 '22 23:11

NightOwl888