Requiring a "clean build" prior to check-in


Another question that came up during our Team System migration was
How do we require developers to only check in code that compiles?
This is a perfectly reasonable request, since checking in code that doesn't compile would be pathological. But I'm sure you know your share of pathological developers, too..

At first glance, the existing check-in policies don't appear to work. Is it time to create a new check-in policy? Not so fast! It is possible to require a clean build prior to check in using the built-in policies, but it's not exactly intuitive.

All you need to do, as it turns out, is add the Code Analysis check-in policy:



You don't have to actually do any code analysis; you can de-select all the code analysis rules if you want. Just make sure you select "Enforce Code Analysis for Managed Code".



Once you enable this rule and attempt to check in non-compilable code, you'll get the expected "Hey, genius, you can only check in code that compiles" check-in policy warning:



That's because code analysis requires a clean build to work its magic.

(with thanks to Erwyn Van Der Meer, who first discovered this)

posted on Monday, February 27, 2006 4:38 PM by jatwood

Comments

# VSTS Links - 03/01/2006

Rob Caron points us to a process guidance print tool. He also talks about TDD in Agitator and Team System....
Wednesday, March 01, 2006 8:24 AM by Team System News

# re: Requiring a "clean build" prior to check-in

doesnt work (at least for web projects)
Tuesday, June 27, 2006 8:37 AM by a