fix(ci): use VS Pro MSBuild (requires Office workload) instead of Build Tools
VS Build Tools 2022 does not ship Microsoft.VisualStudio.Tools.Office.targets (only the full VS IDE editions do), so the VSTO project fails to import them (MSB4226). The runner machine already has VS Pro 2022 with the Office workload installed; switch from microsoft/setup-msbuild@v2 (which picks Build Tools via -latest) to a manual vswhere step that explicitly requires the Office workload. Also removes the temporary filesystem-debug step (root cause was the Win32 File System Redirector pulling system32 paths to SysWOW64 for 32-bit nuget/MSBuild; fixed at the runner level via USERPROFILE redirect, not in the workflow). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+18
-19
@@ -19,25 +19,19 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Debug — show what checkout produced
|
||||
- name: Add Office-capable MSBuild to PATH
|
||||
shell: powershell
|
||||
run: |
|
||||
Write-Host "CWD: $(Get-Location)"
|
||||
Write-Host "GITHUB_WORKSPACE: $env:GITHUB_WORKSPACE"
|
||||
Write-Host ""
|
||||
Write-Host "=== Top-level entries ==="
|
||||
Get-ChildItem -Force | Format-Table Name, Length, Mode
|
||||
Write-Host ""
|
||||
Write-Host "=== All .csproj and .sln files ==="
|
||||
Get-ChildItem -Recurse -File -Include *.csproj,*.sln -ErrorAction SilentlyContinue |
|
||||
ForEach-Object { Write-Host "$($_.FullName) ($($_.Length) bytes)" }
|
||||
Write-Host ""
|
||||
Write-Host "=== src/ tree ==="
|
||||
if (Test-Path src) { Get-ChildItem -Recurse src -Depth 1 -ErrorAction SilentlyContinue | ForEach-Object { Write-Host $_.FullName } }
|
||||
else { Write-Host "src/ does not exist!" }
|
||||
|
||||
- name: Add MSBuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
# microsoft/setup-msbuild@v2 picks `vswhere -latest`, which prefers
|
||||
# Build Tools 2022. Build Tools has no VSTO targets (MSB4226), so
|
||||
# locate a VS installation that explicitly has the Office workload
|
||||
# (the one that ships Microsoft.VisualStudio.Tools.Office.targets).
|
||||
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||
$installPath = & $vswhere -products * -requires Microsoft.VisualStudio.Workload.Office -property installationPath | Select-Object -First 1
|
||||
if (-not $installPath) { throw "No VS installation with the Office workload found on this runner." }
|
||||
$msbuildDir = Join-Path $installPath 'MSBuild\Current\Bin'
|
||||
Write-Host "Using MSBuild from $msbuildDir"
|
||||
Add-Content -Path $env:GITHUB_PATH -Value $msbuildDir
|
||||
|
||||
- name: Setup NuGet
|
||||
uses: nuget/setup-nuget@v2
|
||||
@@ -66,8 +60,13 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Add MSBuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
- name: Add Office-capable MSBuild to PATH
|
||||
shell: powershell
|
||||
run: |
|
||||
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||
$installPath = & $vswhere -products * -requires Microsoft.VisualStudio.Workload.Office -property installationPath | Select-Object -First 1
|
||||
if (-not $installPath) { throw "No VS installation with the Office workload found on this runner." }
|
||||
Add-Content -Path $env:GITHUB_PATH -Value (Join-Path $installPath 'MSBuild\Current\Bin')
|
||||
|
||||
- name: Setup NuGet
|
||||
uses: nuget/setup-nuget@v2
|
||||
|
||||
Reference in New Issue
Block a user