如何使用 Cake 脚本清除本地 nuget 包缓存

How to clear the local nuget package cache using the Cake script

我需要清除系统中缓存的 NuGet。

我可以在命令提示符下运行执行以下命令。

nuget locals -clear all

如何使用 Cake 脚本执行相同的操作。

请提出可能的方法。

Cake 中还没有适用于该 nuget 命令的包装器,但您可以像这样从 Cake 中像启动进程一样轻松地启动它

int nugteClear = StartProcess("nuget", "locals -clear all");
if (nugteClear != 0)
{
    throw new Exception("Failed to clear package cache.");
}