Fail AppVeyor Build if MSI does not build (#5755)

Before this PR, when a WiX compilation error occurs then an error is thrown, which appears in the log with details but the AppVeyor build itself is still marked as green.
This PR makes the console host also return an exit code of -1 when being run on AppVeyor so that it can then interpret it as a build failure and mark the build as red. It uses the fact that AppVeyor defines an environment variable named CI. Exiting is OK since the MSI build is the last step in CI and nothing happens after that.
The git history shows a test build that proves that this works if the installer was broken.
This commit is contained in:
Chris 2018-01-02 23:08:32 +00:00 committed by Travis Plunk
parent 238ff90d72
commit 5f171963b5

View File

@ -2182,7 +2182,12 @@ function New-MSIPackage
$WiXHeatLog | Out-String | Write-Verbose -Verbose
$WiXCandleLog | Out-String | Write-Verbose -Verbose
$WiXLightLog | Out-String | Write-Verbose -Verbose
throw "Failed to create $msiLocationPath"
$errorMessage = "Failed to create $msiLocationPath"
if ($null -ne $env:CI)
{
Add-AppveyorCompilationMessage $errorMessage -Category Error -FileName $MyInvocation.ScriptName -Line $MyInvocation.ScriptLineNumber
}
throw $errorMessage
}
}