Skip to content

Commit 935875a

Browse files
authored
Merge pull request #4146 from CommunityToolkit/wow6432node
Updated Windows SDK locator script to make it more resilient to x86 vs x64 environments.
2 parents 7b49dae + 4691738 commit 935875a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

build/Find-WindowsSDKVersions.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ function Test-RegistryPathAndValue {
8282
catch {
8383
}
8484

85+
try {
86+
$path = $path -replace "HKLM:\\SOFTWARE\\", "HKLM:\\SOFTWARE\\WOW6432Node\\"
87+
if (Test-Path $path) {
88+
Get-ItemProperty -Path $path | Select-Object -ExpandProperty $value -ErrorAction Stop | Out-Null
89+
return $true
90+
}
91+
}
92+
catch {
93+
}
94+
8595
return $false
8696
}
8797

@@ -100,6 +110,11 @@ function Test-InstallWindowsSdk([string] $WindowsSDKVersion) {
100110
if (Test-RegistryPathAndValue -Path $WindowsSDKInstalledRegPath -Value "$WindowsSDKOptions") {
101111
# It appears we have what we need. Double check the disk
102112
$sdkRoot = Get-ItemProperty -Path $WindowsSDKRegPath | Select-Object -ExpandProperty $WindowsSDKRegRootKey
113+
if (!$sdkRoot) {
114+
$WindowsSDKRegPath = $WindowsSDKRegPath -replace "HKLM:\\SOFTWARE\\", "HKLM:\\SOFTWARE\\WOW6432Node\\"
115+
$sdkRoot = Get-ItemProperty -Path $WindowsSDKRegPath | Select-Object -ExpandProperty $WindowsSDKRegRootKey
116+
}
117+
103118
if ($sdkRoot) {
104119
if (Test-Path $sdkRoot) {
105120
$refPath = Join-Path $sdkRoot "References\$WindowsSDKVersion"

0 commit comments

Comments
 (0)