Forcing a TFS2010 workflow build to FAIL instead of PARTIALLY SUCCEED

天大地大妈咪最大 提交于 2019-12-05 03:59:58

What happened here is that when the build finishes, the workflow manager will overwrite the build status to a value that depends on the combination of statuses of the build process. In your case, the CompilationStatus is Succeeded, but there is a custom activity failure (you set the BuildStatus to Failed), so the overall status would be PartiallySucceeded.

The only workaround here is to set the CompilationStatus to either Failed or Unknown, then the build status will be Failed.

I haven't tried setting the CompilationStatus to Unknown though. But if it can be done, you can later go back and change it to Passed. Just a way to distinguish with the real failed compilation builds.

Not a great workaround, I know :(

UPDATE: Using SetBuildProperties activity to set the build status to Failed and I was able to fail the build even though the compilation succeeded.

In TFS 2013, using a customized build template you can just set the the build status to Failed while leaving the CompilationStatus and TestStatus to it's rightful values. You have to do it after the test run though, otherwise it gets updated back. Use the SetBuildProperties activity and set the "Status" property.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!