|
32 | 32 |
|
33 | 33 | . ".\Get-AutoSDK-PlatformPath.ps1"
|
34 | 34 | . ".\Get-VisualStudio-Installs.ps1"
|
| 35 | +. ".\Get-WindowsSDK-Path.ps1" |
35 | 36 |
|
36 | 37 | $AutoSDKRoot = Get-Item -Path $Path -ErrorAction SilentlyContinue
|
37 | 38 | if (-not $AutoSDKRoot) {
|
@@ -116,42 +117,12 @@ $VSInstalls | ForEach-Object {
|
116 | 117 | }
|
117 | 118 | }
|
118 | 119 |
|
119 |
| -$windowsSDKDir = "" |
120 |
| -# This method which calls the official Microsoft script to find the Windows SDK works when called from an interactive shell, |
121 |
| -# but does not when called from inside a PowerShell script. I do not know why. I would prefer to call the official Microsoft tool, |
122 |
| -# so that if the method changes, the script will still work. However, for now, I will use the method contained inside that official |
123 |
| -# command, but in PowerShell form. |
124 |
| -#$winSDKFinderPath = [IO.Path]::Combine($VSInstalls[0].installationPath, "Common7", "Tools", "vsdevcmd", "core", "vsdevcmd_start.bat") |
125 |
| -# Run $winSDKFinderPath and get the environment variable for WIndowsSdkDir |
126 |
| -#$windowsSDKDir = (& cmd /c .\GetSDKPath.cmd $winSDKFinderPath) |
127 |
| - |
128 |
| -# TODO: we *could* have the user invoke this script from inside a Visual Studio Developer Command Prompt, in which case we could just use the environment variable. |
129 |
| -# I'd rather find out what's wrong with trying to call the official Microsoft script from inside a PowerShell script, though. |
130 |
| - |
131 |
| -# Instead, search HKLM:\SOFTWARE\Wow6432Node, HKCU:\SOFTWARE\Wow6432Node, HKLM:\SOFTWARE, HKCU:\SOFTWARE for the Microsoft\Microsoft SDKs\Windows\v10.0 key |
132 |
| -# Epic does not suport Windows 8.1 and lower, so let's just grab for v10. Windows 11 does not have a separate kit at this time. |
133 |
| -$keyPath = "\Microsoft\Microsoft SDKs\Windows\v10.0" |
134 |
| -$regPathsToSearch = @( |
135 |
| - "HKLM:\SOFTWARE" |
136 |
| - "HKCU:\SOFTWARE" |
137 |
| - "HKLM:\SOFTWARE\Wow6432Node" |
138 |
| - "HKCU:\SOFTWARE\Wow6432Node" |
139 |
| -) |
140 |
| -$regPathsToSearch | ForEach-Object { |
141 |
| - $regPath = $_ + $keyPath |
142 |
| - Write-Verbose "Searching $regPath" |
143 |
| - if (Test-Path $regPath) { |
144 |
| - Write-Verbose "Found $regPath" |
145 |
| - $windowsSDKDir = (Get-ItemProperty -Path $regPath -Name "InstallationFolder").InstallationFolder |
146 |
| - } |
147 |
| -} |
148 |
| -$windowsSDKDir = Get-Item -Path $windowsSDKDir | Select-Object -ExpandProperty Parent | Select-Object -ExpandProperty FullName |
| 120 | +$windowsSDKDir = Get-WindowsSDK-Path |
149 | 121 | Write-Output "Windows SDK Dir: $windowsSDKDir"
|
150 | 122 |
|
151 | 123 | $win10SDKDirPath = [IO.Path]::Combine($windowsSDKDir, "10")
|
152 | 124 | if (-not $SkipWindowsSDK) {
|
153 | 125 | # Copy the Windows SDK to $AutoSDKPlatformPath\Windows Kits\10
|
154 |
| - # TODO: For reasons I completely don't understand, if I specify "Windows Kits", "10" as the destination, I get "Windows Kits\10\10" as the destination. |
155 | 126 | $outDir = [IO.Path]::Combine($AutoSDKPlatformPath, "Windows Kits")
|
156 | 127 | if (-not (Test-Path $outDir)) {
|
157 | 128 | Write-Output "Creating directory: $outDir"
|
|
0 commit comments