mirror of
https://github.com/microsoft/terminal.git
synced 2026-07-08 18:16:28 +00:00
Get Windows SDK path from Registry (#19042)
## Summary of the Pull Request The Windows SDK path may not be the same on all PCs, especially when Visual Studio (VS) is installed on a drive other than `C:/`. However, we can read the correct path from the Registry, which this PR does. ## Validation Steps Performed 1. Install VS on `E:/`. 2. Build the solution and see it passes without erroring on accessing `MakePri.exe`.
This commit is contained in:
@@ -22,9 +22,14 @@ Param(
|
|||||||
[Parameter(HelpMessage="Path to makeappx.exe")]
|
[Parameter(HelpMessage="Path to makeappx.exe")]
|
||||||
[ValidateScript({Test-Path $_ -Type Leaf})]
|
[ValidateScript({Test-Path $_ -Type Leaf})]
|
||||||
[string]
|
[string]
|
||||||
$MakeAppxPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\MakeAppx.exe"
|
$MakeAppxPath
|
||||||
)
|
)
|
||||||
|
|
||||||
|
If (-not $MakeAppxPath) {
|
||||||
|
$winSdk10Root = $(Get-ItemPropertyValue -Path "HKLM:\Software\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10")
|
||||||
|
$MakeAppxPath = "$winSdk10Root\bin\10.0.26100.0\x86\MakeAppx.exe"
|
||||||
|
}
|
||||||
|
|
||||||
If ($null -Eq (Get-Item $MakeAppxPath -EA:SilentlyContinue)) {
|
If ($null -Eq (Get-Item $MakeAppxPath -EA:SilentlyContinue)) {
|
||||||
Write-Error "Could not find MakeAppx.exe at `"$MakeAppxPath`".`nMake sure that -MakeAppxPath points to a valid SDK."
|
Write-Error "Could not find MakeAppx.exe at `"$MakeAppxPath`".`nMake sure that -MakeAppxPath points to a valid SDK."
|
||||||
Exit 1
|
Exit 1
|
||||||
|
|||||||
@@ -16,11 +16,21 @@ Param(
|
|||||||
[Parameter(HelpMessage="Path to makepri.exe")]
|
[Parameter(HelpMessage="Path to makepri.exe")]
|
||||||
[ValidateScript({Test-Path $_ -Type Leaf})]
|
[ValidateScript({Test-Path $_ -Type Leaf})]
|
||||||
[string]
|
[string]
|
||||||
$MakePriPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\MakePri.exe"
|
$MakePriPath
|
||||||
)
|
)
|
||||||
|
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
If (-not $MakePriPath) {
|
||||||
|
$winSdk10Root = $(Get-ItemPropertyValue -Path "HKLM:\Software\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10")
|
||||||
|
$MakePriPath = "$winSdk10Root\bin\10.0.26100.0\x64\MakePri.exe"
|
||||||
|
}
|
||||||
|
|
||||||
|
If ($null -Eq (Get-Item $MakePriPath -EA:SilentlyContinue)) {
|
||||||
|
Write-Error "Could not find MakePriPath.exe at `"$MakePriPath`".`nMake sure that -MakePriPath points to a valid SDK."
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
|
||||||
$tempDir = Join-Path ([System.IO.Path]::GetTempPath()) "tmp$([Convert]::ToString((Get-Random 65535),16).PadLeft(4,'0')).tmp"
|
$tempDir = Join-Path ([System.IO.Path]::GetTempPath()) "tmp$([Convert]::ToString((Get-Random 65535),16).PadLeft(4,'0')).tmp"
|
||||||
New-Item -ItemType Directory -Path $tempDir | Out-Null
|
New-Item -ItemType Directory -Path $tempDir | Out-Null
|
||||||
$priConfig = Join-Path $tempDir "priconfig.xml"
|
$priConfig = Join-Path $tempDir "priconfig.xml"
|
||||||
|
|||||||
@@ -17,11 +17,21 @@ Param(
|
|||||||
[Parameter(HelpMessage="Path to makepri.exe")]
|
[Parameter(HelpMessage="Path to makepri.exe")]
|
||||||
[ValidateScript({Test-Path $_ -Type Leaf})]
|
[ValidateScript({Test-Path $_ -Type Leaf})]
|
||||||
[string]
|
[string]
|
||||||
$MakePriPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\MakePri.exe"
|
$MakePriPath
|
||||||
)
|
)
|
||||||
|
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
If (-not $MakePriPath) {
|
||||||
|
$winSdk10Root = $(Get-ItemPropertyValue -Path "HKLM:\Software\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10")
|
||||||
|
$MakePriPath = "$winSdk10Root\bin\10.0.26100.0\x64\MakePri.exe"
|
||||||
|
}
|
||||||
|
|
||||||
|
If ($null -Eq (Get-Item $MakePriPath -EA:SilentlyContinue)) {
|
||||||
|
Write-Error "Could not find MakePriPath.exe at `"$MakePriPath`".`nMake sure that -MakePriPath points to a valid SDK."
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
|
||||||
$tempDir = Join-Path ([System.IO.Path]::GetTempPath()) "tmp$([Convert]::ToString((Get-Random 65535),16).PadLeft(4,'0')).tmp"
|
$tempDir = Join-Path ([System.IO.Path]::GetTempPath()) "tmp$([Convert]::ToString((Get-Random 65535),16).PadLeft(4,'0')).tmp"
|
||||||
New-Item -ItemType Directory -Path $tempDir | Out-Null
|
New-Item -ItemType Directory -Path $tempDir | Out-Null
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ Param(
|
|||||||
[Parameter(HelpMessage="Path to makeappx.exe", ParameterSetName='Layout')]
|
[Parameter(HelpMessage="Path to makeappx.exe", ParameterSetName='Layout')]
|
||||||
[ValidateScript({Test-Path $_ -Type Leaf})]
|
[ValidateScript({Test-Path $_ -Type Leaf})]
|
||||||
[string]
|
[string]
|
||||||
$MakeAppxPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\MakeAppx.exe",
|
$MakeAppxPath,
|
||||||
|
|
||||||
[Parameter(HelpMessage="Include the portable mode marker file by default", ParameterSetName='AppX')]
|
[Parameter(HelpMessage="Include the portable mode marker file by default", ParameterSetName='AppX')]
|
||||||
[Parameter(HelpMessage="Include the portable mode marker file by default", ParameterSetName='Layout')]
|
[Parameter(HelpMessage="Include the portable mode marker file by default", ParameterSetName='Layout')]
|
||||||
@@ -39,6 +39,11 @@ $filesToCopyFromXaml = @("Microsoft.UI.Xaml.dll", "Microsoft.UI.Xaml") # We don'
|
|||||||
|
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
If (-not $MakeAppxPath) {
|
||||||
|
$winSdk10Root = $(Get-ItemPropertyValue -Path "HKLM:\Software\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10")
|
||||||
|
$MakeAppxPath = "$winSdk10Root\bin\10.0.26100.0\x64\MakeAppx.exe"
|
||||||
|
}
|
||||||
|
|
||||||
If ($null -Eq (Get-Item $MakeAppxPath -EA:SilentlyContinue)) {
|
If ($null -Eq (Get-Item $MakeAppxPath -EA:SilentlyContinue)) {
|
||||||
Write-Error "Could not find MakeAppx.exe at `"$MakeAppxPath`".`nMake sure that -MakeAppxPath points to a valid SDK."
|
Write-Error "Could not find MakeAppx.exe at `"$MakeAppxPath`".`nMake sure that -MakeAppxPath points to a valid SDK."
|
||||||
Exit 1
|
Exit 1
|
||||||
|
|||||||
@@ -6,13 +6,18 @@ Param(
|
|||||||
$Path,
|
$Path,
|
||||||
|
|
||||||
[Parameter(HelpMessage="Path to Windows Kit")]
|
[Parameter(HelpMessage="Path to Windows Kit")]
|
||||||
[ValidateScript({Test-Path $_ -Type Leaf})]
|
[ValidateScript({Test-Path $_})]
|
||||||
[string]
|
[string]
|
||||||
$WindowsKitPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0"
|
$WindowsKitPath
|
||||||
)
|
)
|
||||||
|
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
If (-not $WindowsKitPath) {
|
||||||
|
$winSdk10Root = $(Get-ItemPropertyValue -Path "HKLM:\Software\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10")
|
||||||
|
$WindowsKitPath = "$winSdk10Root\bin\10.0.26100.0"
|
||||||
|
}
|
||||||
|
|
||||||
If ($null -Eq (Get-Item $WindowsKitPath -EA:SilentlyContinue)) {
|
If ($null -Eq (Get-Item $WindowsKitPath -EA:SilentlyContinue)) {
|
||||||
Write-Error "Could not find a windows SDK at at `"$WindowsKitPath`".`nMake sure that WindowsKitPath points to a valid SDK."
|
Write-Error "Could not find a windows SDK at at `"$WindowsKitPath`".`nMake sure that WindowsKitPath points to a valid SDK."
|
||||||
Exit 1
|
Exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user