From d804d7fd30c564d20234453fe296fe01420ba607 Mon Sep 17 00:00:00 2001 From: bergmeister Date: Thu, 14 Sep 2017 22:12:51 +0100 Subject: [PATCH] Make the build output the WiX compilation log if it failed. (#4831) * Make the build output the WiX compilation log if it failed. Before it was not outputting it not at all because the build output is an array that was piped directly to 'Write-Verbose' instead of converting it to a string using 'Out-String' Because the WiX log is usually quite verbose (around 250 lines), the log is only shown if there must have been a compilation error due to the missing MSI * PR 4831: Use -Verbose option on Write-Verbose to force output in build as suggested in review. --- build.psm1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build.psm1 b/build.psm1 index 8d260f41f9..0d87ac13b1 100644 --- a/build.psm1 +++ b/build.psm1 @@ -1840,9 +1840,9 @@ function New-MSIPackage Write-Error -Message "Package already exists, use -Force to overwrite, path: $msiLocationPath" -ErrorAction Stop } - & $wixHeatExePath dir $ProductSourcePath -dr $productVersionWithName -cg $productVersionWithName -gg -sfrag -srd -scom -sreg -out $wixFragmentPath -var env.ProductSourcePath -v | Write-Verbose - & $wixCandleExePath "$ProductWxsPath" "$wixFragmentPath" -out (Join-Path "$env:Temp" "\\") -ext WixUIExtension -ext WixUtilExtension -arch x64 -v | Write-Verbose - & $wixLightExePath -out $msiLocationPath $wixObjProductPath $wixObjFragmentPath -ext WixUIExtension -ext WixUtilExtension -dWixUILicenseRtf="$LicenseFilePath" -v | Write-Verbose + $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 x64 -v + $WiXLightLog = & $wixLightExePath -out $msiLocationPath $wixObjProductPath $wixObjFragmentPath -ext WixUIExtension -ext WixUtilExtension -dWixUILicenseRtf="$LicenseFilePath" -v Remove-Item -ErrorAction SilentlyContinue *.wixpdb -Force @@ -1853,6 +1853,9 @@ function New-MSIPackage } else { + $WiXHeatLog | Out-String | Write-Verbose -Verbose + $WiXCandleLog | Out-String | Write-Verbose -Verbose + $WiXLightLog | Out-String | Write-Verbose -Verbose throw "Failed to create $msiLocationPath" } }