Configuring Team System Code Analysis via a FxCop rules file
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.)
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.
With the release of TFS 2010 this has completely changed. There's now the ability to specify ruleset files in your project configuration. You can share these between projects or even between environments.
精彩评论