Reputation: 1577
In my team I want to prevent developer to check-in code with warnings from code analysis.
Like I found in some blogs and stackoverflow-questions I tried to make this with a check-in policy:
The Problem now I have is, that the policy only prevent checkin if there are errors, but not if there are only warnings. Of course I can change the ruleset and set all rules as errors. But then also local builds are not possible.
So, what I want is that that the rules all are warnings and building the project is possible but check-in is prevented also if only warning exists.
My idea was, to set a different ruleset in checkin policy settings (same rules but all rules as error). But by trying check-in y get the error: Code analysis settings are not compatible with code analysis policy.
So my question is, if somebody has a solution or idea how I can solve this problem.
Thanks in advance for your answer!
Upvotes: 2
Views: 2350
Reputation: 21
I tried this in V2010 (that is, treat warnings as errors) but it only worked for compiler warnings, not CA warnings. So my CA warnings still remained as warnings whereas my compiler warnings now became errors.
Upvotes: 2
Reputation: 8544
If I get it right the behavior you after after is :
In order to get this:
Now, be careful that you may run in a situation, where build succeeds in every DEV-workstation & fails in TFS. That would be really bad.
One way to avoid this, is to change your build's Trigger into "Gated Check-in", so that if there are warnings - build will fail & developers can't check in.
This last step, is -in some way- a replacement for the check-in policy you removed.
Upvotes: 1