I have two build steps in my build configuration: Visual Studio (sln) build runner, followed by an FxCop build ru开发者_运维知识库nner. I'm using TeamCity 6.0.1 and FxCop 10.0.
Out of the box, the FxCop runner in TeamCity seems to only report on rule violations, and produces a report on a Code Inspection tab. I want to ensure that if any violation occurs that the build step fails and thus causes an entire build failure.
Is there a way to accomplish this?
Please set the Errors limit property in your FxCop build step configuration to 0. This should break the build if there is at least one analysis error.
Furthermore, there is a similar Warnings limit property. If you don't want to allow any rule violation at warning level, insert in this field also the value 0. If you want to allow rule violations where the rule attribute BreaksBuild == False, leave this property empty.
I've tried that using TeamCity 6.0 (build 15772) and FxCop 10.0.
[14:39:22]: [Step 2/2] Importing inspection results
[14:39:22]: [Step 2/2] Errors limit reached: found 8 errors, limit 0
[14:39:22]: [Step 2/2] ##teamcity[buildStatus status='FAILURE' text='Errors: 8, warnings: 1']
In the version 7.0 EAP it is special "Build fail condition" in Build Configuration=>Build Failure conditions=>Add build failure condirion, e.g. "Fail build if number of inspection errors is more than 30"
精彩评论