在恢复Nuget软件包时,软件包将在本地计算机中缓存,下次当我想使用最新的Nuget软件包(使用相同版本,但文件已更新)时,将从我的计算机中检索旧版本 .
我使用以下命令清除本地计算机缓存中的Nuget包:
nuget locals -clear all
而不是这样做可以阻止Nuget包在系统中缓存 .
是的,使用它可用的 nocache 选项
nocache
安装 - https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference#install
恢复 - https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference#restore
如果你想100%确定你可以将 NUGET_PACKAGES 环境变量设置为临时路径,它每次都会在新的地方查找和存储 .
NUGET_PACKAGES
当你用Cake标记问题时 - 我猜你正在使用它,NuGetAliases for install and restore也支持NoCache .
NuGetInstallSettings具有NoCache属性
NuGetRestoreSettings具有NoCache属性
要从Cake脚本设置 NUGET_PACKAGES 环境变量,您可以使用EnvironmentVariables属性可用于所有Cake工具,包括NuGetInstallSettings和NuGetRestoreSettings,设置它看起来像这样
new NuGetRestoreSettings { NoCache = true, EnvironmentVariables = new Dictionary<string, string>{ { "NUGET_PACKAGES", MakeAbsolute(Directory("./some_temp_path")).FullPath } } }
1 回答
是的,使用它可用的
nocache
选项安装 - https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference#install
恢复 - https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference#restore
如果你想100%确定你可以将
NUGET_PACKAGES
环境变量设置为临时路径,它每次都会在新的地方查找和存储 .当你用Cake标记问题时 - 我猜你正在使用它,NuGetAliases for install and restore也支持NoCache .
NuGetInstallSettings具有NoCache属性
NuGetRestoreSettings具有NoCache属性
要从Cake脚本设置
NUGET_PACKAGES
环境变量,您可以使用EnvironmentVariables属性可用于所有Cake工具,包括NuGetInstallSettings和NuGetRestoreSettings,设置它看起来像这样