Public/Teamcity/Write-TeamcityBuildProblem.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
function Write-TeamcityBuildProblem { [CmdletBinding()] param ( # The message you want displayed in TeamCity [Parameter( Mandatory = $true, Position = 0 )] [string] $Message, # If set to true this will throw an exception instead of writing to StdErr. [Parameter( Mandatory = $false )] [switch] $TerminatingError ) $Message = $Message -replace "`n", "" -replace "`r", "" Write-Host "##teamcity[buildProblem description='$Message']" -ForegroundColor Red if ($TerminatingError) { throw $Message } else { Write-Error $Message } } |