我正在尝试使用Cake作为构建工具,但在他们的 powershell 脚本中遇到了问题。
该脚本试图nuget.exe
在环境变量路径中查找。如果它不存在,它会下载它。
问题是msbuild.exe
总是返回,如果nuget.exe
不存在,脚本会失败,因为它试图给我们msbuild.exe
$existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_) }
$NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
无论exe
我尝试使用此脚本搜索哪个,即使它存在,msbuild.exe
也总是在列表中返回。