views:

176

answers:

1

Is there anyway to configure the code analysis rules in Visual Studio Team System to match those in an FxCop configuration file and keep them in sync automatically?

Not all the developers on the team have TS so keeping the rules we are currently running in an FxCop file is required so everyone can run the same set, but it would nice for those with to be able to run them in the IDE. We're introducing static analysis to an existing project so turning on everything now isn't a useful option. (We are not using Foundation Server for source control, if that makes any difference.)

A: 

You can use the CodeAnalysisProject property to specify an FxCop project file that defines the rules for a Visual Studio project. However, in order for this to work correctly in VStudio, the FxCop project file can only contain rule specifications, not target assemblies, which means that you would probably need two versions of your FxCop project: one with targets and one without.

Given that you're presumably not activating large sets of rules at any given time, another approach would be to used a shared MSBuild targets file for specifying the rule list for VStudio. Unless you automatically generate the targets file from the FxCop file, this would require a bit more manual update work, but that would still represent very little effort at any given rule activation.

Nicole Calinoiu
Thanks. Didn't know about CodeAnalysisProject but not having targets means it doesn't really fit. Automatic merges between the two formats look painful because as far as I can see FxCop uses rule names and VSTS using the CA id numbers. Shared MSBuild might work I'll have to investigate.
Ian G