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:
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:
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: .NET