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
ordotnet 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 setsglobalPackagesFolder
(if using PackageReference) orrepositoryPath
(if usingpackages.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 withnuget restore
or the--no-cache
option withdotnet 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
ordotnet 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