Skip to content

Commit a7d4f99

Browse files
adityapatwardhanchrisdent-de
authored andcommitted
Update installation on Wix module (PowerShell#23808)
1 parent 0249c03 commit a7d4f99

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

tools/wix/wix.psm1

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,37 @@ function Install-Wix
3636
}
3737
$binPath = Join-Path -Path $targetRoot -ChildPath 'bin'
3838

39-
Register-PSRepository -Name 'dotnet-eng' -SourceLocation "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json"
39+
$psresourceGet = Get-Module -ListAvailable -Name 'Microsoft.PowerShell.PSResourceGet' -ErrorAction SilentlyContinue
40+
41+
if (-not $psresourceGet) {
42+
Install-Module -Name 'Microsoft.PowerShell.PSResourceGet' -Force -AllowClobber -Scope CurrentUser
43+
}
44+
45+
$respository = Get-PSResourceRepository -Name 'dotnet-eng' -ErrorAction SilentlyContinue
46+
47+
if (-not $respository) {
48+
Write-Verbose -Verbose "Registering dotnet-eng repository..."
49+
Register-PSResourceRepository -Name 'dotnet-eng' -Uri 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' -Trusted
50+
}
51+
4052
# keep version in sync with Microsoft.PowerShell.Packaging.csproj
41-
Save-Module -name Microsoft.Signed.Wix -RequiredVersion '3.14.1-8722.20240403.1' -path "$binPath/"
42-
$docExpandPath = Join-Path -Path $binPath -ChildPath 'doc'
43-
$sdkExpandPath = Join-Path -Path $binPath -ChildPath 'sdk'
53+
54+
if (-not (Test-Path $binPath)) {
55+
$null = New-Item -ItemType Directory -Path $binPath
56+
Write-Verbose -Verbose "Created bin directory for WIX at $binPath"
57+
}
58+
59+
try {
60+
Save-PSResource -Name 'Microsoft.Signed.Wix' -Repository 'dotnet-eng' -path "$binPath/" -Prerelease
61+
}
62+
finally {
63+
Write-Verbose -Verbose "Unregistering dotnet-eng repository..."
64+
Unregister-PSResourceRepository -Name 'dotnet-eng'
65+
}
66+
67+
$docExpandPath = Join-Path -Path "$binPath\Microsoft.Signed.Wix\3.14.1\tools\" -ChildPath 'doc'
68+
$sdkExpandPath = Join-Path -Path "$binPath\Microsoft.Signed.Wix\3.14.1\tools\" -ChildPath 'sdk'
69+
$x86ExpandPath = Join-Path -Path "$binPath\Microsoft.Signed.Wix\3.14.1\tools\" -ChildPath 'x86'
4470

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

@@ -73,7 +99,7 @@ function Install-Wix
7399
Write-Verbose "Fixing folder structure ..." -Verbose
74100
Copy-Item -Path $docExpandPath -Destination $docTargetPath -Force
75101
Copy-Item -Path $sdkExpandPath -Destination $sdkTargetPath -Force
76-
Copy-Item -Path "$binPath\wix\3.14.1\tools\*" -Destination $binTargetPath -Force
102+
Copy-Item -Path "$binPath\Microsoft.Signed.Wix\3.14.1\tools\*" -Destination $binTargetPath -Force
77103
Copy-Item -Path $x86ExpandPath -Destination $x86TargetPath -Force -Recurse -Verbose
78104
Copy-Item -Path "$x86ExpandPath\burn.exe" -Destination "$x86TargetPath\burn.exe" -Force -Verbose
79105

0 commit comments

Comments
 (0)