修改Nuget包默认存放路径,避免增加C盘的负担
一、找到默认位置
打开文件C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config。打开这个xml,里面存放了默认路径:
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\"/> </packageSources> </configuration>
二、修改默认位置
修改如上的xml,增加config节点,如下:
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\"/> </packageSources> <config> <add key="globalPackagesFolder" value="D:\Nuget\Package" /> </config> </configuration>
重启VS后生效
备注:vs2019nuget地址:https://api.nuget.org/v3/index.json