From ca0f94471266116a997ba2abf87f036bdee5e9f6 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Sun, 9 Aug 2026 19:36:14 -0700 Subject: [PATCH] CI: install MSVC build tools on Windows runners that lack them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit build-windows failed on this PR with "linker `link.exe` not found", while build-linux and build-container passed — the code was fine, the runner environment was not. The job installs Rust and Node conditionally but assumed the MSVC C++ toolchain was hand-provisioned. A runner without it registers normally, advertises windows-latest, accepts the job, downloads the entire crate graph and only then fails at link time. That also means a bare runner coming online turns a job that would have queued for a capable machine into a failed build. Installs the VC++ workload when vswhere cannot find it, matching the existing conditional Rust and Node steps. rustc locates MSVC through vswhere and the registry rather than PATH, so no dev-shell activation is needed. Installer exit 3010 (success, reboot pending) is treated as success. Co-Authored-By: Claude Opus 5 (1M context) --- .gitea/workflows/build-app.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.gitea/workflows/build-app.yml b/.gitea/workflows/build-app.yml index 968f5ab..25a0b3b 100644 --- a/.gitea/workflows/build-app.yml +++ b/.gitea/workflows/build-app.yml @@ -357,6 +357,38 @@ jobs: (Get-Content app/src-tauri/Cargo.toml) -replace '^version = ".*?"', "version = `"$version`"" | Set-Content app/src-tauri/Cargo.toml Write-Host "Patched version to $version" + - name: Install MSVC C++ build tools + shell: cmd + run: | + rem Tauri links with MSVC, so rustc needs link.exe and the Windows SDK. + rem This job previously assumed a hand-provisioned runner; a runner + rem without them registers fine, accepts windows-latest jobs, and then + rem fails at link time with "linker `link.exe` not found" after having + rem already downloaded the whole crate graph. + rem + rem rustc locates MSVC through vswhere/the registry rather than PATH, + rem so installing is sufficient — no dev-shell activation needed here. + set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" + if exist "%VSWHERE%" ( + "%VSWHERE%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath > "%TEMP%\vcpath.txt" 2>nul + for /f "usebackq delims=" %%i in ("%TEMP%\vcpath.txt") do set "VCPATH=%%i" + ) + if defined VCPATH ( + echo MSVC build tools already present at %VCPATH% + ) else ( + echo MSVC build tools not found - installing Visual Studio Build Tools + curl -fSL -o "%TEMP%\vs_BuildTools.exe" https://aka.ms/vs/17/release/vs_BuildTools.exe || exit /b 1 + rem 3010 means "installed, reboot pending" and is a success for our purposes. + "%TEMP%\vs_BuildTools.exe" --quiet --wait --norestart --nocache ^ + --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended + set "VSEXIT=%ERRORLEVEL%" + del "%TEMP%\vs_BuildTools.exe" 2>nul + if not "%VSEXIT%"=="0" if not "%VSEXIT%"=="3010" ( + echo Visual Studio Build Tools installer failed with %VSEXIT% + exit /b %VSEXIT% + ) + echo Visual Studio Build Tools installed + ) - name: Install Rust stable run: | where rustup >nul 2>&1 && (