From b8b88055dd030c023b33d8b84350c11e01866a69 Mon Sep 17 00:00:00 2001 From: Tushar Singh Date: Mon, 16 Jun 2025 20:04:42 +0530 Subject: [PATCH 1/3] read windows sdk root path from registry --- build/scripts/Merge-PriFiles.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build/scripts/Merge-PriFiles.ps1 b/build/scripts/Merge-PriFiles.ps1 index 3a9985936aa..0e5db5219b8 100644 --- a/build/scripts/Merge-PriFiles.ps1 +++ b/build/scripts/Merge-PriFiles.ps1 @@ -16,11 +16,16 @@ Param( [Parameter(HelpMessage="Path to makepri.exe")] [ValidateScript({Test-Path $_ -Type Leaf})] [string] - $MakePriPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\MakePri.exe" + $MakePriPath ) $ErrorActionPreference = 'Stop' +if (-not $MakePriPath) { + $winSdk10Root = $(Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10") + $MakePriPath = "$winSdk10Root\bin\10.0.22621.0\x64\MakePri.exe" +} + $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 $priConfig = Join-Path $tempDir "priconfig.xml" From 26d2b81a61f297a91aa7632e8ab5f1137bb26d77 Mon Sep 17 00:00:00 2001 From: Tushar Singh Date: Thu, 19 Jun 2025 22:21:49 +0530 Subject: [PATCH 2/3] update makeappx makepri paths --- build/scripts/Create-AppxBundle.ps1 | 7 ++++++- build/scripts/Merge-PriFiles.ps1 | 9 +++++++-- build/scripts/Merge-TerminalAndXamlResources.ps1 | 12 +++++++++++- build/scripts/New-UnpackagedTerminalDistribution.ps1 | 7 ++++++- build/scripts/Test-WindowsTerminalPackage.ps1 | 7 ++++++- 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/build/scripts/Create-AppxBundle.ps1 b/build/scripts/Create-AppxBundle.ps1 index 9c120f63203..b267e35088f 100644 --- a/build/scripts/Create-AppxBundle.ps1 +++ b/build/scripts/Create-AppxBundle.ps1 @@ -22,9 +22,14 @@ Param( [Parameter(HelpMessage="Path to makeappx.exe")] [ValidateScript({Test-Path $_ -Type Leaf})] [string] - $MakeAppxPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.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.22621.0\x86\MakeAppx.exe" +} + 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." Exit 1 diff --git a/build/scripts/Merge-PriFiles.ps1 b/build/scripts/Merge-PriFiles.ps1 index 0e5db5219b8..600f468f66b 100644 --- a/build/scripts/Merge-PriFiles.ps1 +++ b/build/scripts/Merge-PriFiles.ps1 @@ -21,11 +21,16 @@ Param( $ErrorActionPreference = 'Stop' -if (-not $MakePriPath) { - $winSdk10Root = $(Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10") +If (-not $MakePriPath) { + $winSdk10Root = $(Get-ItemPropertyValue -Path "HKLM:\Software\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10") $MakePriPath = "$winSdk10Root\bin\10.0.22621.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" New-Item -ItemType Directory -Path $tempDir | Out-Null $priConfig = Join-Path $tempDir "priconfig.xml" diff --git a/build/scripts/Merge-TerminalAndXamlResources.ps1 b/build/scripts/Merge-TerminalAndXamlResources.ps1 index 92c8bad5565..dec78898df7 100644 --- a/build/scripts/Merge-TerminalAndXamlResources.ps1 +++ b/build/scripts/Merge-TerminalAndXamlResources.ps1 @@ -17,11 +17,21 @@ Param( [Parameter(HelpMessage="Path to makepri.exe")] [ValidateScript({Test-Path $_ -Type Leaf})] [string] - $MakePriPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\MakePri.exe" + $MakePriPath ) $ErrorActionPreference = 'Stop' +If (-not $MakePriPath) { + $winSdk10Root = $(Get-ItemPropertyValue -Path "HKLM:\Software\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10") + $MakePriPath = "$winSdk10Root\bin\10.0.22621.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" New-Item -ItemType Directory -Path $tempDir | Out-Null diff --git a/build/scripts/New-UnpackagedTerminalDistribution.ps1 b/build/scripts/New-UnpackagedTerminalDistribution.ps1 index 9f8d295be85..aa81e075647 100644 --- a/build/scripts/New-UnpackagedTerminalDistribution.ps1 +++ b/build/scripts/New-UnpackagedTerminalDistribution.ps1 @@ -25,7 +25,7 @@ Param( [Parameter(HelpMessage="Path to makeappx.exe", ParameterSetName='Layout')] [ValidateScript({Test-Path $_ -Type Leaf})] [string] - $MakeAppxPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.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='Layout')] @@ -39,6 +39,11 @@ $filesToCopyFromXaml = @("Microsoft.UI.Xaml.dll", "Microsoft.UI.Xaml") # We don' $ErrorActionPreference = 'Stop' +If (-not $MakeAppxPath) { + $winSdk10Root = $(Get-ItemPropertyValue -Path "HKLM:\Software\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10") + $MakeAppxPath = "$winSdk10Root\bin\10.0.22621.0\x64\MakeAppx.exe" +} + 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." Exit 1 diff --git a/build/scripts/Test-WindowsTerminalPackage.ps1 b/build/scripts/Test-WindowsTerminalPackage.ps1 index b492eca05f1..7521ba1951e 100644 --- a/build/scripts/Test-WindowsTerminalPackage.ps1 +++ b/build/scripts/Test-WindowsTerminalPackage.ps1 @@ -8,11 +8,16 @@ Param( [Parameter(HelpMessage="Path to Windows Kit")] [ValidateScript({Test-Path $_ -Type Leaf})] [string] - $WindowsKitPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0" + $WindowsKitPath ) $ErrorActionPreference = "Stop" +If (-not $WindowsKitPath) { + $winSdk10Root = $(Get-ItemPropertyValue -Path "HKLM:\Software\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10") + $WindowsKitPath = "$winSdk10Root/bin/10.0.22621.0" +} + 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." Exit 1 From d23c814f72b1f89845486218592d850a34b194aa Mon Sep 17 00:00:00 2001 From: Tushar Date: Thu, 19 Jun 2025 23:16:24 +0530 Subject: [PATCH 3/3] Fix path --- build/scripts/Test-WindowsTerminalPackage.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/scripts/Test-WindowsTerminalPackage.ps1 b/build/scripts/Test-WindowsTerminalPackage.ps1 index 7521ba1951e..efe8352256b 100644 --- a/build/scripts/Test-WindowsTerminalPackage.ps1 +++ b/build/scripts/Test-WindowsTerminalPackage.ps1 @@ -15,7 +15,7 @@ $ErrorActionPreference = "Stop" If (-not $WindowsKitPath) { $winSdk10Root = $(Get-ItemPropertyValue -Path "HKLM:\Software\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10") - $WindowsKitPath = "$winSdk10Root/bin/10.0.22621.0" + $WindowsKitPath = "$winSdk10Root\bin\10.0.22621.0" } If ($null -Eq (Get-Item $WindowsKitPath -EA:SilentlyContinue)) {