summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author5an7y <[email protected]>2026-04-07 14:55:32 -0700
committer5an7y <[email protected]>2026-04-07 14:55:32 -0700
commit6b271bfe71e1994f9103e5988cf3ee1db0b7d0e6 (patch)
tree9dfbcaf07030779b1ff0ce04eb4a0d8a5cef4870
parent05135c4ec0a93d50e84deaf6a758ca956b1cb6eb (diff)
fix: detect WDK component in both full VS and Build Tools
Full VS editions register the WDK as 'Microsoft.Windows.DriverKit', while Build Tools uses 'Component.Microsoft.Windows.DriverKit.BuildTools'. Query vswhere for both component IDs and deduplicate by install path so machines with only VS Build Tools are properly detected. Co-authored-by: Copilot <[email protected]>
-rw-r--r--BuildEnvironment.ps117
1 files changed, 14 insertions, 3 deletions
diff --git a/BuildEnvironment.ps1 b/BuildEnvironment.ps1
index d05456c3..bdb90a2e 100644
--- a/BuildEnvironment.ps1
+++ b/BuildEnvironment.ps1
@@ -18,10 +18,21 @@ function Get-VsInstallationsWithWdk {
exit 1
}
- $json = & $vswhere -all -products * -format json -requires Microsoft.Windows.DriverKit -include packages 2>$null
- $installations = $json | ConvertFrom-Json
+ # Full VS editions install the WDK component as 'Microsoft.Windows.DriverKit',
+ # while Build Tools uses 'Component.Microsoft.Windows.DriverKit.BuildTools'.
+ # Query for either so both product types are discovered.
+ $wdkComponentIds = @('Microsoft.Windows.DriverKit', 'Component.Microsoft.Windows.DriverKit.BuildTools')
+ $allInstallations = @()
+ foreach ($componentId in $wdkComponentIds) {
+ $json = & $vswhere -all -products * -format json -requires $componentId -include packages 2>$null
+ if ($json) {
+ $allInstallations += ($json | ConvertFrom-Json)
+ }
+ }
+ # Deduplicate by installationPath in case both components are present
+ $installations = $allInstallations | Sort-Object -Property installationPath -Unique
return $installations | ForEach-Object {
- $wdkPackage = $_.packages | Where-Object { $_.id -eq 'Microsoft.Windows.DriverKit' } | Select-Object -First 1
+ $wdkPackage = $_.packages | Where-Object { $_.id -in $wdkComponentIds } | Select-Object -First 1
[PSCustomObject]@{
DisplayName = $_.displayName
InstallationPath = $_.installationPath