Skip to content

Commit

Permalink
Update installation on Wix module (#23808)
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapatwardhan committed May 16, 2024
1 parent 53df284 commit da1ca4a
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions tools/wix/wix.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,37 @@ function Install-Wix
}
$binPath = Join-Path -Path $targetRoot -ChildPath 'bin'

Register-PSRepository -Name 'dotnet-eng' -SourceLocation "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json"
$psresourceGet = Get-Module -ListAvailable -Name 'Microsoft.PowerShell.PSResourceGet' -ErrorAction SilentlyContinue

if (-not $psresourceGet) {
Install-Module -Name 'Microsoft.PowerShell.PSResourceGet' -Force -AllowClobber -Scope CurrentUser
}

$respository = Get-PSResourceRepository -Name 'dotnet-eng' -ErrorAction SilentlyContinue

if (-not $respository) {
Write-Verbose -Verbose "Registering dotnet-eng repository..."
Register-PSResourceRepository -Name 'dotnet-eng' -Uri 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' -Trusted
}

# keep version in sync with Microsoft.PowerShell.Packaging.csproj
Save-Module -name Microsoft.Signed.Wix -RequiredVersion '3.14.1-8722.20240403.1' -path "$binPath/"
$docExpandPath = Join-Path -Path $binPath -ChildPath 'doc'
$sdkExpandPath = Join-Path -Path $binPath -ChildPath 'sdk'

if (-not (Test-Path $binPath)) {
$null = New-Item -ItemType Directory -Path $binPath
Write-Verbose -Verbose "Created bin directory for WIX at $binPath"
}

try {
Save-PSResource -Name 'Microsoft.Signed.Wix' -Repository 'dotnet-eng' -path "$binPath/" -Prerelease
}
finally {
Write-Verbose -Verbose "Unregistering dotnet-eng repository..."
Unregister-PSResourceRepository -Name 'dotnet-eng'
}

$docExpandPath = Join-Path -Path "$binPath\Microsoft.Signed.Wix\3.14.1\tools\" -ChildPath 'doc'
$sdkExpandPath = Join-Path -Path "$binPath\Microsoft.Signed.Wix\3.14.1\tools\" -ChildPath 'sdk'
$x86ExpandPath = Join-Path -Path "$binPath\Microsoft.Signed.Wix\3.14.1\tools\" -ChildPath 'x86'

$docTargetPath = Join-Path -Path $targetRoot -ChildPath 'doc'

Expand Down Expand Up @@ -73,7 +99,7 @@ function Install-Wix
Write-Verbose "Fixing folder structure ..." -Verbose
Copy-Item -Path $docExpandPath -Destination $docTargetPath -Force
Copy-Item -Path $sdkExpandPath -Destination $sdkTargetPath -Force
Copy-Item -Path "$binPath\wix\3.14.1\tools\*" -Destination $binTargetPath -Force
Copy-Item -Path "$binPath\Microsoft.Signed.Wix\3.14.1\tools\*" -Destination $binTargetPath -Force
Copy-Item -Path $x86ExpandPath -Destination $x86TargetPath -Force -Recurse -Verbose
Copy-Item -Path "$x86ExpandPath\burn.exe" -Destination "$x86TargetPath\burn.exe" -Force -Verbose

Expand Down

0 comments on commit da1ca4a

Please sign in to comment.