Skip to content

Commit 6648914

Browse files
committed
ci(build): replace Chocolatey MFC install with Visual Studio bootstrapper
Switches the workflow from Chocolatey to the official Visual Studio Build Tools bootstrapper to install VCTools and MFC components. This avoids community feed timeouts, removes nondeterministic 0/0 install failures, and installs the toolchain into C:\BuildTools for isolation from the preinstalled VS instance.
1 parent b1d1391 commit 6648914

1 file changed

Lines changed: 36 additions & 11 deletions

File tree

.github/workflows/build.yml

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,51 @@ jobs:
2525
- name: Add MSBuild to PATH
2626
uses: microsoft/setup-msbuild@v2
2727

28-
- name: Install MFC libraries via Chocolatey
28+
29+
30+
- name: Install MFC libraries via Visual Studio bootstrapper
31+
shell: pwsh
2932
run: |
30-
Write-Host "Installing MFC components via Chocolatey..."
31-
choco install visualstudio2022-workload-vctools --package-parameters "--add Microsoft.VisualStudio.Component.VC.ATLMFC" --yes
33+
Write-Host "Locating existing Visual Studio installation..."
34+
35+
# GitHub runners always have VS 2022 Enterprise here
36+
$vsInstall = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
37+
38+
if (-Not (Test-Path $vsInstall)) {
39+
Write-Host "❌ Could not find Visual Studio installation at $vsInstall"
40+
exit 1
41+
}
42+
43+
Write-Host "Found Visual Studio at: $vsInstall"
3244
33-
# Wait for installation to complete
34-
Start-Sleep -Seconds 30
45+
Write-Host "Downloading Visual Studio Build Tools bootstrapper..."
46+
$vsUrl = "https://aka.ms/vs/17/release/vs_buildtools.exe"
47+
$vsExe = "$env:TEMP\vs_buildtools.exe"
48+
Invoke-WebRequest $vsUrl -OutFile $vsExe
49+
50+
Write-Host "Installing required Visual Studio components into existing installation..."
51+
52+
& $vsExe `
53+
--quiet --wait --norestart --nocache `
54+
--installPath "$vsInstall" `
55+
--add Microsoft.VisualStudio.Workload.VCTools `
56+
--add Microsoft.VisualStudio.Component.VC.ATLMFC `
57+
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64
58+
59+
Write-Host "Verifying MFC installation..."
60+
61+
$mfcPath = Get-ChildItem "$vsInstall\VC\Tools\MSVC\*\atlmfc" -ErrorAction SilentlyContinue
3562
36-
# Verify installation
37-
$mfcPath = Get-ChildItem "${env:ProgramFiles}\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\*\atlmfc" -ErrorAction SilentlyContinue
3863
if ($mfcPath) {
3964
Write-Host "✅ MFC libraries found at: $($mfcPath.FullName)"
4065
} else {
4166
Write-Host "❌ MFC installation failed"
42-
Get-ChildItem "${env:ProgramFiles}\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\" -ErrorAction SilentlyContinue
67+
Write-Host "Contents of MSVC folder:"
68+
Get-ChildItem "$vsInstall\VC\Tools\MSVC\" -ErrorAction SilentlyContinue
4369
exit 1
4470
}
45-
shell: powershell
71+
72+
4673
4774
- name: Run MSBuild with Code Analysis
4875
run: |
@@ -102,5 +129,3 @@ jobs:
102129
files: |
103130
colorcop.zip
104131
output/colorcop-setup.exe
105-
106-

0 commit comments

Comments
 (0)