Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Throw an Error in an MSBuild Task

Tags:

msbuild

How do you throw an error from within an MSBuild task and force the build to fail. Something like:

<Task>
  <ThrowError Condition="$(SomeCondition)" Message="There was a problem with the build" />
</Task>
like image 952
according2me Avatar asked Mar 08 '10 15:03

according2me


2 Answers

Use the Error Task

<Error Condition="$(SomeCondition)" Text="There was a problem with the build" />
like image 140
Luhmann Avatar answered Oct 12 '22 15:10

Luhmann


The Error-task would do the trick.

<Error
            Text="errormessage"
            Condition="errorcondition" />
like image 30
Arve Avatar answered Oct 12 '22 14:10

Arve