Skip to content

Commit

Permalink
update wix package install (#21537)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgauth committed May 2, 2024
1 parent 5efd627 commit 361403c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
13 changes: 0 additions & 13 deletions .pipelines/templates/windows-package-build.yml
Expand Up @@ -78,19 +78,6 @@ jobs:
ob_restore_phase: true # This ensures this done in restore phase to workaround signing issue
- pwsh: |
# cleanup previous install
if((Test-Path "${env:ProgramFiles(x86)}\WiX Toolset xcopy")) {
Remove-Item "${env:ProgramFiles(x86)}\WiX Toolset xcopy" -Recurse -Force
}
$toolsDir = New-Item -ItemType Directory -Path '$(Build.ArtifactStagingDirectory)\tools'
$wixUri = 'https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip'
Invoke-RestMethod -Uri $wixUri -OutFile '$(Build.ArtifactStagingDirectory)\tools\wix.zip' -MaximumRetryCount 5 -RetryIntervalSec 10
Import-Module '$(PowerShellRoot)\tools\releaseBuild\Images\microsoft_powershell_windowsservercore\wix.psm1'
$isArm64 = '$(Runtime)' -eq 'arm64'
Install-WixZip -zipPath '$(Build.ArtifactStagingDirectory)\tools\wix.zip' -arm64:$isArm64
$msixUrl = '$(makeappUrl)'
Invoke-RestMethod -Uri $msixUrl -OutFile '$(Pipeline.Workspace)\makeappx.zip'
Expand-Archive '$(Pipeline.Workspace)\makeappx.zip' -destination '\' -Force
Expand Down
7 changes: 6 additions & 1 deletion build.psm1
Expand Up @@ -778,7 +778,7 @@ function Restore-PSPackage

if (-not $ProjectDirs)
{
$ProjectDirs = @($Options.Top, "$PSScriptRoot/src/TypeCatalogGen", "$PSScriptRoot/src/ResGen", "$PSScriptRoot/src/Modules")
$ProjectDirs = @($Options.Top, "$PSScriptRoot/src/TypeCatalogGen", "$PSScriptRoot/src/ResGen", "$PSScriptRoot/src/Modules", "$PSScriptRoot/tools/wix")

if ($Options.Runtime -like 'fxdependent*') {
$ProjectDirs += "$PSScriptRoot/src/Microsoft.PowerShell.GlobalTool.Shim"
Expand Down Expand Up @@ -2295,6 +2295,11 @@ function Start-PSBootstrap {
$psInstallFile = [System.IO.Path]::Combine($PSScriptRoot, "tools", "install-powershell.ps1")
& $psInstallFile -AddToPath
}
if ($Package) {
Import-Module '$(PowerShellRoot)\tools\wix\wix.psm1'
$isArm64 = '$(Runtime)' -eq 'arm64'
Install-Wix -arm64:$isArm64
}
}
} finally {
Pop-Location
Expand Down
9 changes: 9 additions & 0 deletions tools/wix/Microsoft.PowerShell.Packaging.csproj
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<Import Project="..\..\PowerShell.Common.props" />

<ItemGroup>
<!-- Keep version in sync with wix.psm1 line 18 -->
<PackageReference Include="WiX" Version="3.14.1" />
</ItemGroup>

</Project>
Expand Up @@ -4,14 +4,19 @@ Import-Module "$PSScriptRoot\dockerInstall.psm1"

# Install using Wix Zip because the MSI requires an older version of dotnet
# which was large and unstable in docker
function Install-WixZip
function Install-Wix
{
param($zipPath, $arm64 = $false)
param($arm64 = $false)

$targetRoot = $arm64 ? "${env:ProgramFiles(x86)}\Arm Support WiX Toolset xcopy" : "${env:ProgramFiles(x86)}\WiX Toolset xcopy"
# cleanup previous install
if(Test-Path $targetRoot) {
Remove-Item $targetRoot -Recurse -Force
}
$binPath = Join-Path -Path $targetRoot -ChildPath 'bin'
Write-Verbose "Expanding $zipPath to $binPath ..." -Verbose
Expand-Archive -Path $zipPath -DestinationPath $binPath -Force
Register-PSRepository -Name NuGetGallery -SourceLocation https://api.nuget.org/v3/index.json
# keep version in sync with Microsoft.PowerShell.Packaging.csproj
Save-Module -name wix -RequiredVersion 3.14.1 -path "$binPath/"
$docExpandPath = Join-Path -Path $binPath -ChildPath 'doc'
$sdkExpandPath = Join-Path -Path $binPath -ChildPath 'sdk'
$docTargetPath = Join-Path -Path $targetRoot -ChildPath 'doc'
Expand Down

0 comments on commit 361403c

Please sign in to comment.