Forcing restore from package sources

https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore#forcing-restore-from-package-sources

By default, NuGet restore operations use packages from the global-packages and http-cache folders, which are described on Managing the global packages and cache folders.

To avoid using the global-packages folder, do one of the following:

  • Clear the folder using nuget locals global-packages -clear or dotnet nuget locals global-packages --clear
  • Temporarily change the location of the global-packages folder before the restore operation using one of the following methods:
    • Set the NUGET_PACKAGES environment variable to a different folder.
    • Create a NuGet.Config file that sets globalPackagesFolder (if using PackageReference) or repositoryPath (if using packages.config) to a different folder (see configuration settings
    • MSBuild only: specify a different folder with the RestorePackagesPath property.

To avoid using the cache for HTTP sources, do one of the following:

  • Use the -NoCache option with nuget restore or the --no-cache option with dotnet restore. These options do not affect restore operations through the Visual Studio Package Manager UI or Console.
  • Clear the cache using nuget locals http-cache -clear or dotnet nuget locals http-cache --clear.
  • Temporarily set of the NUGET_HTTP_CACHE_PATH environment variable to a different folder.

 

执行这2个命令

nuget locals global-packages -clear

Use the -NoCache option with nuget restore

 

Example

nuget sources add -Name "rdc" -Source http://172.31.212.138:8089/Nuget
nuget locals global-packages -clear
nuget restore LISA.CMSWeb.sln -NoCache
pause

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(217)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2017-02-18 Binary operations #1
2016-02-18 What a version number means
2016-02-18 RSA (cryptosystem)
点击右上角即可分享
微信分享提示