How to move the NuGet cache folder

Source: Internet
Author: User
Tags creative commons attribution

Original: How to move the NuGet cache folder

This article tells you how to move the NuGet cache folder.

Because the NuGet folder is generally larger, now my NuGet folder has ten G, the default NuGet folder is on the C drive, so you need to move him.



You can use the following code to view the folder where the NuGet global cache files reside

all-list

You can see the following output

HTTP-CACHE:C:\users\user\appdata\local\nuget\v3-cache#NuGet 3.x+ Cachepackages-cache:c:\users\user\appdata\local\nuget\cache  #NuGet 2.x CACHEGLOBAL-PACKAGES:C:\users\user\.NuGet\packages\          #Global Packages Foldertemp:c:\users\user\appdata\local\temp\nugetscratch      #Temp folder

As you can see, where the global cache folder is placed on the C drive, then I provide two ways to modify

Modify Links

You can use Administrator privileges to run PowerShell for folder links, first copy the NuGet package folder to another place, I move to D:\lindexi\packages , so you can use the following code to move the NuGet folder to another folder

mklink /d C:\Users\lindexi\.nuget\packages D:\lindexi\packages

Before using this code, you need to delete C:\Users\lindexi\.nuget\packages This string and modify it to your own NuGet folder.

Configuration

In addition to the methods above, you can modify the global folder by modifying the configuration

Open%appdata%\nuget\nuget.config, add the following code to this folder

<configuration>  <config>     <add key="globalPackagesFolder" value="D:\lindexi\packages" />  </config></configuration>

Please change the moved NuGet folder to your own folder.

<?xml version= "1.0" encoding= "Utf-8"?><configuration>  <packagesources>    <add key="nuget.org" value="Https://api.nuget.org/v3/index.json"  protocolversion="3" />    <add key="Cnblog" value="https://nuget.cnblogs.com/v3/ Index.json " />  </packagesources>  <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>  <config>     <add key="Globalpackagesfolder" value="D:\Users\linde\. Nuget\packages " />  </config></configuration>
NuGet Cachemac
    • ~/.local/share/nuget/cache
    • ~/.nuget/packages
Windows
    • %localappdata%\nuget\cache
    • %userprofile%\.nuget\packages
Linux

~/.local/share/nuget/cache
~/.nuget/packages

NuGet Configuration

Mac ~/.config/nuget/nuget.config

Windows%appdata%\nuget\nuget.config

Linux ~/.config/nuget/nuget.config

See also: NuGet File Locations-matt Ward


This work is licensed under the Creative Commons Attribution-NonCommercial use-Share 4.0 International license agreement in the same way. Welcome to reprint, use, republish, but be sure to keep the article Attribution Lindesi (including Link: http://blog.csdn.net/lindexi_gd), not for commercial purposes, based on the modified works of this article must be issued with the same license. If you have any questions, please contact me.

How to move the NuGet cache folder

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.