diff --git a/.gitignore b/.gitignore
index 5900f796f96..942123b261d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,7 @@ dotnet-uninstall-debian-packages.sh
# Ignore binaries and symbols
*.pdb
*.dll
+*.wixpdb
# Ignore packages
*.deb
diff --git a/assets/Product.wxs b/assets/Product.wxs
index db6cbbed5c5..5bec5e8d7e1 100644
--- a/assets/Product.wxs
+++ b/assets/Product.wxs
@@ -157,7 +157,7 @@
-
+
+
@@ -289,8 +294,6 @@
1
"1"]]>
- 1
-
NOT Installed
Installed AND PATCH
diff --git a/build.psm1 b/build.psm1
index af8cecb77d9..0f8a98b77ce 100644
--- a/build.psm1
+++ b/build.psm1
@@ -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 {
diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1
index 885c62e1cba..533feedbeb6 100644
--- a/tools/packaging/packaging.psm1
+++ b/tools/packaging/packaging.psm1
@@ -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"}
- 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)
{
diff --git a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1
index 1ff7ba872cc..b725a75fe3d 100644
--- a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1
+++ b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1
@@ -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