How to bind a target within MSBuild to a general error
We are using TFS build and we have a couple of custom steps within the configuration (e.g. running NUnit tests in AfterCompile
target, deployment steps in AfterDropBuild
target etc.). Now I wanted to add the functionality of sending emails on broken builds. I have configured a mail task from MS Community tasks and put it to the BeforeOnBuildBreak
target. This works perfectly if there is a compilation error, we are 开发者_Python百科even getting the notification emails.
However, when there is an error in some custom task (e.g. there is a failed test in this NUnit test run), the BeforeOnBuildBreak target is not even executed. Is there some other (more general) target or any other way to execute custom logic in case of any build failure ?
For individual tasks you could set ContinueOnError="True"
property and then check for errors, send notification and fail the build manually using the Error
task.
精彩评论