If your team has a minbar of Managed Code Analysis rules that must be explicitly fixed or suppressed, it is possible to share the Managed Code Analysis rule settings over multiple MSBuild projects (.csproj, .vbproj).
To share the minbar between multiple projects, do the following:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <CodeAnalysisRules>$(CodeAnalysisRules);[rulesettings]</CodeAnalysisRules> </PropertyGroup> </Project>
If you do not want developers to be able to turn on extra rules over and above the minbar, do not add the '$(CodeAnalysisRules);' text.
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
[...]
<Import Project="[path]" /> </Project>
Any projects that imported the common rule settings via Step 9, should now reflect these settings in the Code Analysis properties pane. You can also share any MSBuild properties using similar steps.
Please Note: In order to avoid Visual Studio prompting about unsafe imported MSBuild projects, you need to explicitly trust the [team].CodeAnalysis.Rules.targets file. To do this, use the following: