tools: update deploy-to-host.ps1 to automatically detect host arch (#14343)

* tools: update deploy-to-host.ps1 to automatically detect host architecture * pr feedback --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

Ben Hillis committed Mar 3, 2026 at 17:13 UTC 6747ae808acd3895ed1b23ffdb8aa9d4b6978066
2 files changed +9 -3
msipackage/CMakeLists.txt
+1 -1
@@ -66,5 +66,5 @@ if (DEFINED WSL_POST_BUILD_COMMAND)
66 POST_BUILD
67 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
68 USES_TERMINAL
69 - COMMAND ${WSL_POST_BUILD_COMMAND} -Platform ${TARGET_PLATFORM} -BuildType ${CMAKE_BUILD_TYPE})
69 + COMMAND ${WSL_POST_BUILD_COMMAND} -BuildType ${CMAKE_BUILD_TYPE})
70 endif()
\ No newline at end of file
tools/deploy/deploy-to-host.ps1
+8 -2
@@ -2,7 +2,6 @@
2
3 [cmdletbinding(PositionalBinding = $false)]
4 param (
5 - [ValidateSet("X64", "arm64")][string]$Platform = "X64",
5 [ValidateSet("Debug", "Release")][string]$BuildType = "Debug",
6 [string]$BuildOutputPath = [string](Get-Location),
7 [string]$PackageCertPath = $null,
@@ -12,10 +11,17 @@ param (
11
12 $ErrorActionPreference = "Stop"
13
14 +$processorArchitecture = (Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment').PROCESSOR_ARCHITECTURE
15 +$Platform = switch -Wildcard ($processorArchitecture) {
16 + '*ARM64*' { 'arm64' }
17 + '*AMD64*' { 'X64' }
18 + default { throw "Failed to determine system architecture: $processorArchitecture" }
19 +}
20 +
21 $PackagePath = "$BuildOutputPath\bin\$Platform\$BuildType\wsl.msi"
22
23 # msiexec.exe doesn't like symlinks, so use the canonical path
18 -$Target = (Get-ChildItem $PackagePath)[0].Target
24 +$Target = (Get-ChildItem $PackagePath).Target
25 if ($Target)
26 {
27 $PackagePath = $Target