Fri, Nov 4 2005 9:55 AM Erwyn van der Meer

How to enfore clean build for check-in in Visual Studio Team System (part 2)

Please read part 1 first. In that post I suggested to add a code analysis check-in policy to Team System with no rules selected if you only want to enfore a clean build policy. This is necessary because the separate clean build check-in policy has disappeared from Team System after Beta 2.

To comply with the code analysis check-in policies set on a Team Project, the code analysis settings on the Visual Studio project within a solution must be set to be at least as strict. I.e., stricter is fine, but more relaxed is not. This is a screenshot of the settings for a project:

Screenshot of the Code Analysis Settings for a project (click for larger version)

You can merge the settings from a Team Project over on to a Visual Studio project through the menu item File | Source Control | Migrate Code Analysis Policy Settings to Solution. This adds the rules in the Team Project Policy that have not already been set on the Visual Studio projects within the current solution. It leaves additional rules set on the projects in place.

As it turns out, it is okay to have not any rule set on the Team Project code analysis check-in policy. But Visual Studio will give you a CA0051 No rules were selected compilation error when you do the same on a project:

Screenshot of CA0051 No rules were selected error in Visual Studio 2005 (click for more details)

Nevertheless if the build was succesful, Visual Studio remembers this and you can check-in your code without any problems.

To get rid of the non-fatal "compilation" error you have to select at least one rule, like in the screenshot above, to stop Visual Studio from complaining.




Filed under:

# re: How to enfore clean build for check-in in Visual Studio Team System (part 2)

Friday, November 04, 2005 12:30 AM by Dennis van der Stelt

I'm a little disturbed as to how you found this! I cannot believe Erwyn would want to turn off every single rule! :)

# re: How to enfore clean build for check-in in Visual Studio Team System (part 2)

Friday, November 04, 2005 1:08 AM by Erwyn van der Meer

Thanks for the comment, Dennis. Actually that went through my mind before posting this.

Introducing the Daily WTF at work didn't go well with some team members. So, I might try a more subtle approach: "langzaam de duimschroeven aandraaien" ;) Sorry, for any non-Dutch speakers, I don't know what the expression in English is.

# re: How to enfore clean build for check-in in Visual Studio Team System (part 2)

Friday, November 04, 2005 3:39 AM by Dennis van der Stelt

Hahahaha, that's funny! Good luck with "het aandraaien van de duimschroeven", I like your approach now you've explained it! :D