Fix: Modern Terminal blank under SYSTEM; precise reason in info list
This commit is contained in:
12
build.ps1
12
build.ps1
@@ -43,6 +43,18 @@ foreach ($pattern in $msBuildPaths) {
|
||||
}
|
||||
}
|
||||
|
||||
# 兜底:默认路径找不到(例如 VS 装在 D 盘)时,用 vswhere 反查。
|
||||
# vswhere.exe 由 VS Installer 维护,固定在 %ProgramFiles(x86)% 下,与 VS 本体盘符无关。
|
||||
if (-not $msBuild) {
|
||||
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||
if (Test-Path $vswhere) {
|
||||
$found = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild `
|
||||
-find "MSBuild\**\Bin\MSBuild.exe" 2>$null |
|
||||
Select-Object -First 1
|
||||
if ($found) { $msBuild = $found }
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $msBuild) {
|
||||
Write-Host "ERROR: MSBuild not found." -ForegroundColor Red
|
||||
Write-Host ""
|
||||
|
||||
Reference in New Issue
Block a user