在MSBuild任务中引发错误

时间:2010-03-08 15:13:57

标签: msbuild

如何从MSBuild任务中抛出错误并强制构建失败。类似的东西:

<Task>
  <ThrowError Condition="$(SomeCondition)" Message="There was a problem with the build" />
</Task>

3 个答案:

答案 0 :(得分:23)

使用Error Task

<Error Condition="$(SomeCondition)" Text="There was a problem with the build" />

答案 1 :(得分:2)

Error-task可以解决问题。

<Error
            Text="errormessage"
            Condition="errorcondition" />

答案 2 :(得分:1)

您是否尝试过Error而不是ThrowError?它对我有用;)