Skip to content

Commit c308dfd

Browse files
committed
ci: remove pre-installed WDK toolsets from non-v160 dirs
The windows-2025 runner has a newer WDK pre-installed in v170. MSBuild prefers v170 over v160, hitting the wrong Toolset.props which references v141/v142 that don't exist under v170.
1 parent 7a3d34c commit c308dfd

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/winredirect-driver-sync.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,22 @@ jobs:
8686
Copy-Item $wdkVsix $vsixZip -Force
8787
Expand-Archive $vsixZip -DestinationPath $vsixDir -Force
8888
89+
$vcTargetsBase = Join-Path $vsInstall 'MSBuild\Microsoft\VC'
90+
$wdkToolsets = @('WindowsKernelModeDriver10.0', 'WindowsUserModeDriver10.0', 'WindowsApplicationForDrivers10.0')
91+
foreach ($ver in (Get-ChildItem $vcTargetsBase -Directory -Filter 'v1*' -Exclude 'v160')) {
92+
foreach ($plat in (Get-ChildItem (Join-Path $ver.FullName 'Platforms') -Directory -ErrorAction SilentlyContinue)) {
93+
foreach ($ts in $wdkToolsets) {
94+
$tsDir = Join-Path $plat.FullName "PlatformToolsets\$ts"
95+
if (Test-Path $tsDir) {
96+
Write-Host "Removing pre-installed WDK toolset: $tsDir"
97+
Remove-Item $tsDir -Recurse -Force
98+
}
99+
}
100+
}
101+
}
102+
89103
$vsixSource = Join-Path $vsixDir '$MSBuild\Microsoft\VC\v160'
90-
$vcTargetsDest = Join-Path $vsInstall 'MSBuild\Microsoft\VC\v160'
104+
$vcTargetsDest = Join-Path $vcTargetsBase 'v160'
91105
Write-Host "Installing WDK toolset into $vcTargetsDest"
92106
robocopy $vsixSource $vcTargetsDest /E /IS /IT /NFL /NDL /NJH /NJS /NP
93107
if ($LASTEXITCODE -gt 7) {

0 commit comments

Comments
 (0)