Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dotnet-uninstall-debian-packages.sh
# Ignore binaries and symbols
*.pdb
*.dll
*.wixpdb

# Ignore packages
*.deb
Expand Down
15 changes: 9 additions & 6 deletions assets/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
</RegistryKey>
</Component>
<!-- add ourselves to %PATH% so pwsh.exe can be started from Windows PowerShell or cmd.exe -->
<Component Id="SetPath" Guid="{9dbb7763-7baf-48e7-b025-3bdedcb0632f}">
<Component Id="SetPath" Guid="{9dbb7763-7baf-48e7-b025-3bdedcb0632f}" KeyPath="yes">
<Environment Id="PATH" Action="set" Name="PATH" Part="last" Permanent="no" System="yes" Value="[$(var.ProductVersionWithName)]"/>
</Component>
<!-- Explorer context menu with 2 submenus to open PowerShell normally or as an Administator.
Expand Down Expand Up @@ -211,10 +211,15 @@
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="$(var.ProductName)">
<Component Id="ApplicationProgramsMenuShortcut" Guid="{A77507A7-F970-4618-AC30-20AFE36EE2EB}">
<Shortcut Id="PowerShell_ProgramsMenuShortcut" Name="$(var.ProductSemanticVersionWithNameAndOptionalArchitecture)" Description="$(var.ProductSemanticVersionWithNameAndOptionalArchitecture)" Target="[$(var.ProductVersionWithName)]pwsh.exe" WorkingDirectory="$(var.ProductVersionWithName)"
Icon = "PowerShellExe.ico" />
<Shortcut Id="PowerShell_ProgramsMenuShortcut"
Name="$(var.ProductSemanticVersionWithNameAndOptionalArchitecture)"
Description="$(var.ProductSemanticVersionWithNameAndOptionalArchitecture)"
Target="[$(var.ProductVersionWithName)]pwsh.exe"
WorkingDirectory="$(var.ProductVersionWithName)"
Icon = "PowerShellExe.ico" />
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKLM" Key="Software\Microsoft\$(var.ProductSemanticVersionWithNameAndOptionalArchitecture)\ProgramsMenuShortcut" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
<!-- HKMU is HKLM when installing perMachine and HKCU when installing perUser-->
<RegistryValue Root="HKMU" Key="Software\Microsoft\$(var.ProductSemanticVersionWithNameAndOptionalArchitecture)\ProgramsMenuShortcut" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</Directory>
</Directory>
Expand Down Expand Up @@ -289,8 +294,6 @@
<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>

<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>

Expand Down
39 changes: 37 additions & 2 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2023,15 +2023,50 @@ function script:precheck([string]$command, [string]$missedMessage) {

# this function wraps native command Execution
# for more information, read https://mnaoumov.wordpress.com/2015/01/11/execution-of-external-commands-in-powershell-done-right/
function script:Start-NativeExecution([scriptblock]$sb, [switch]$IgnoreExitcode)
function script:Start-NativeExecution
{
param(
[scriptblock]$sb,
[switch]$IgnoreExitcode,
[switch]$VerboseOutputOnError
)
$backupEAP = $script:ErrorActionPreference
$script:ErrorActionPreference = "Continue"
try {
& $sb
if($VerboseOutputOnError.IsPresent)
{
$output = & $sb
}
else
{
& $sb
}

# note, if $sb doesn't have a native invocation, $LASTEXITCODE will
# point to the obsolete value
if ($LASTEXITCODE -ne 0 -and -not $IgnoreExitcode) {
if($VerboseOutputOnError.IsPresent -and $output)
{
$output | Out-String | Write-Verbose -Verbose
}

# Get caller location for easier debugging
$caller = Get-PSCallStack -ErrorAction SilentlyContinue
if($caller)
{
$callerLocationParts = $caller[1].Location -split ":\s*line\s*"
$callerFile = $callerLocationParts[0]
$callerLine = $callerLocationParts[1]

$errorMessage = "Execution of {$sb} by ${callerFile}: line $callerLine failed with exit code $LASTEXITCODE"

if ($null -ne $env:CI)
{
Add-AppveyorCompilationMessage $errorMessage -Category Error -FileName $callerFile -Line $callerLine
}

throw $errorMessage
}
throw "Execution of {$sb} failed with exit code $LASTEXITCODE"
}
} finally {
Expand Down
31 changes: 22 additions & 9 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1542,36 +1542,49 @@ function New-MSIPackage
$wixObjProductPath = Join-Path $env:Temp "Product.wixobj"
$wixObjFragmentPath = Join-Path $env:Temp "Fragment.wixobj"

# cleanup any garbage on the system
Remove-Item -ErrorAction SilentlyContinue $wixFragmentPath -Force
Remove-Item -ErrorAction SilentlyContinue $wixObjProductPath -Force
Remove-Item -ErrorAction SilentlyContinue $wixObjFragmentPath -Force

$packageName = $productSemanticVersionWithName
if ($ProductNameSuffix) {
$packageName += "-$ProductNameSuffix"
}
$msiLocationPath = Join-Path $pwd "$packageName.msi"
$msiPdbLocationPath = Join-Path $pwd "$packageName.wixpdb"

if(!$Force.IsPresent -and (Test-Path -Path $msiLocationPath))
{
Write-Error -Message "Package already exists, use -Force to overwrite, path: $msiLocationPath" -ErrorAction Stop
}

$WiXHeatLog = & $wixHeatExePath dir $ProductSourcePath -dr $productVersionWithName -cg $productVersionWithName -gg -sfrag -srd -scom -sreg -out $wixFragmentPath -var env.ProductSourcePath -v
$WiXCandleLog = & $wixCandleExePath "$ProductWxsPath" "$wixFragmentPath" -out (Join-Path "$env:Temp" "\\") -ext WixUIExtension -ext WixUtilExtension -arch $ProductTargetArchitecture -v
$WiXLightLog = & $wixLightExePath -out $msiLocationPath $wixObjProductPath $wixObjFragmentPath -ext WixUIExtension -ext WixUtilExtension -dWixUILicenseRtf="$LicenseFilePath" -v
log "running heat..."
Start-NativeExecution -VerboseOutputOnError { & $wixHeatExePath dir $ProductSourcePath -dr $productVersionWithName -cg $productVersionWithName -gg -sfrag -srd -scom -sreg -out $wixFragmentPath -var env.ProductSourcePath -v}

log "running candle..."
Start-NativeExecution -VerboseOutputOnError { & $wixCandleExePath "$ProductWxsPath" "$wixFragmentPath" -out (Join-Path "$env:Temp" "\\") -ext WixUIExtension -ext WixUtilExtension -arch $ProductTargetArchitecture -v}

log "running light..."
# suppress ICE61, because we allow same version upgrades
# suppress ICE57, this suppresses an error caused by our shortcut not being installed per user
Start-NativeExecution -VerboseOutputOnError {& $wixLightExePath -sice:ICE61 -sice:ICE57 -out $msiLocationPath -pdbout $msiPdbLocationPath $wixObjProductPath $wixObjFragmentPath -ext WixUIExtension -ext WixUtilExtension -dWixUILicenseRtf="$LicenseFilePath"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-v is missing at the end. Is it supposed to be added back?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no... it produces a lot of not very useful information. I don't recommend adding it. It makes the logs unreadable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. #Closed


Remove-Item -ErrorAction SilentlyContinue *.wixpdb -Force
Remove-Item -ErrorAction SilentlyContinue $wixFragmentPath -Force
Remove-Item -ErrorAction SilentlyContinue $wixObjProductPath -Force
Remove-Item -ErrorAction SilentlyContinue $wixObjFragmentPath -Force

if (Test-Path $msiLocationPath)
if ((Test-Path $msiLocationPath) -and (Test-Path $msiPdbLocationPath))
{
Write-Verbose "You can find the WixPdb @ $msiPdbLocationPath" -Verbose
Write-Verbose "You can find the MSI @ $msiLocationPath" -Verbose
$msiLocationPath
[pscustomobject]@{
msi=$msiLocationPath
wixpdb=$msiPdbLocationPath
}
}
else
{
$WiXHeatLog | Out-String | Write-Verbose -Verbose
$WiXCandleLog | Out-String | Write-Verbose -Verbose
$WiXLightLog | Out-String | Write-Verbose -Verbose
$errorMessage = "Failed to create $msiLocationPath"
if ($null -ne $env:CI)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ try{

Write-Verbose "Exporting packages ..." -verbose

Get-ChildItem $location\*.msi,$location\*.zip | ForEach-Object {
Get-ChildItem $location\*.msi,$location\*.zip,$location\*.wixpdb | ForEach-Object {
$file = $_.FullName
Write-Verbose "Copying $file to $destination" -verbose
Copy-Item -Path $file -Destination "$destination\" -Force
Expand Down