File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,13 +11,18 @@ jobs:
1111 steps :
1212 - name : Checkout
1313 uses : actions/checkout@v4
14+ - name : Setup MSBuild (add to PATH)
15+ uses : microsoft/setup-msbuild@v2
1416 - name : Locate MSBuild
1517 id : msbuild
1618 shell : pwsh
1719 run : |
18- $msbuild = & "$env:ProgramFiles(x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe | Select-Object -First 1
20+ # 正确取 ProgramFiles(x86) 需要使用 ${env:ProgramFiles(x86)} 否则路径会变成 "Program Files(x86)"
21+ $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
22+ if(-not (Test-Path $vswhere)) { throw "vswhere not found at $vswhere" }
23+ $msbuild = & $vswhere -latest -requires Microsoft.Component.MSBuild -find "MSBuild\**\Bin\MSBuild.exe" | Select-Object -First 1
1924 if(-not $msbuild){ throw 'MSBuild not found' }
20- echo "path=$msbuild" >> $env:GITHUB_OUTPUT
25+ "path=$msbuild" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
2126 - name : Build VSIX (Release)
2227 shell : pwsh
2328 run : |
You can’t perform that action at this time.
0 commit comments