@@ -486,6 +486,12 @@ function Start-PSPackage {
486486 $TargetArchitecture = " x86"
487487 $r2rArchitecture = " i386"
488488 }
489+ elseif ($Runtime -match " -arm64" )
490+ {
491+ $TargetArchitecture = " arm64"
492+ $r2rArchitecture = " arm64"
493+ }
494+
489495 Write-Verbose " TargetArchitecture = $TargetArchitecture " - Verbose
490496
491497 $Arguments = @ {
@@ -3279,12 +3285,23 @@ function Get-NugetSemanticVersion
32793285# Get the paths to various WiX tools
32803286function Get-WixPath
32813287{
3282- $wixToolsetBinPath = " ${env: ProgramFiles(x86)} \WiX Toolset *\bin"
3288+ [CmdletBinding ()]
3289+ param (
3290+ [bool ] $IsProductArchitectureArm = $false
3291+ )
32833292
3284- Write-Verbose " Ensure Wix Toolset is present on the machine @ $wixToolsetBinPath "
3293+ $wixToolsetBinPath = $IsProductArchitectureArm ? " ${env: ProgramFiles(x86)} \Arm Support WiX Toolset *\bin" : " ${env: ProgramFiles(x86)} \WiX Toolset *\bin"
3294+
3295+ Write-Verbose - Verbose " Ensure Wix Toolset is present on the machine @ $wixToolsetBinPath "
32853296 if (-not (Test-Path $wixToolsetBinPath ))
32863297 {
3287- throw " The latest version of Wix Toolset 3.11 is required to create MSI package. Please install it from https://github.com/wixtoolset/wix3/releases"
3298+ if (! $IsProductArchitectureArm )
3299+ {
3300+ throw " The latest version of Wix Toolset 3.11 is required to create MSI package. Please install it from https://github.com/wixtoolset/wix3/releases"
3301+ }
3302+ else {
3303+ throw " The latest version of Wix Toolset 3.14 is required to create MSI package for arm. Please install it from https://aka.ms/ps-wix-3-14-zip"
3304+ }
32883305 }
32893306
32903307 # # Get the latest if multiple versions exist.
@@ -3308,7 +3325,6 @@ function Get-WixPath
33083325 WixLightExePath = $wixLightExePath
33093326 WixInsigniaExePath = $wixInsigniaExePath
33103327 }
3311-
33123328}
33133329
33143330<#
@@ -3360,7 +3376,7 @@ function New-MSIPackage
33603376
33613377 # Architecture to use when creating the MSI
33623378 [Parameter (Mandatory = $true )]
3363- [ValidateSet (" x86" , " x64" )]
3379+ [ValidateSet (" x86" , " x64" , " arm64 " )]
33643380 [ValidateNotNullOrEmpty ()]
33653381 [string ] $ProductTargetArchitecture ,
33663382
@@ -3370,7 +3386,7 @@ function New-MSIPackage
33703386 [string ] $CurrentLocation = (Get-Location )
33713387 )
33723388
3373- $wixPaths = Get-WixPath
3389+ $wixPaths = Get-WixPath - IsProductArchitectureArm ( $ProductTargetArchitecture -eq " arm64 " )
33743390
33753391 $windowsNames = Get-WindowsNames - ProductName $ProductName - ProductNameSuffix $ProductNameSuffix - ProductVersion $ProductVersion
33763392 $productSemanticVersionWithName = $windowsNames.ProductSemanticVersionWithName
@@ -3408,6 +3424,11 @@ function New-MSIPackage
34083424 $fileArchitecture = ' x86'
34093425 $ProductProgFilesDir = " ProgramFilesFolder"
34103426 }
3427+ elseif ($ProductTargetArchitecture -eq " arm64" )
3428+ {
3429+ $fileArchitecture = ' arm64'
3430+ $ProductProgFilesDir = " ProgramFiles64Folder"
3431+ }
34113432
34123433 $wixFragmentPath = Join-Path $env: Temp " Fragment.wxs"
34133434
@@ -3522,7 +3543,7 @@ function New-ExePackage {
35223543
35233544 # Architecture to use when creating the MSI
35243545 [Parameter (Mandatory = $true )]
3525- [ValidateSet (" x86" , " x64" )]
3546+ [ValidateSet (" x86" , " x64" , " arm64 " )]
35263547 [ValidateNotNullOrEmpty ()]
35273548 [string ] $ProductTargetArchitecture ,
35283549
@@ -3644,7 +3665,7 @@ function Start-MsiBuild {
36443665
36453666 $outDir = $env: Temp
36463667
3647- $wixPaths = Get-WixPath
3668+ $wixPaths = Get-WixPath - IsProductArchitectureArm ( $ProductTargetArchitecture -eq " arm64 " )
36483669
36493670 $extensionArgs = @ ()
36503671 foreach ($extensionName in $Extension ) {
0 commit comments