Wednesday, April 16, 2008

How to apply SAME Code Analysis rules to different visual studio projects

Pretty Simple.
1. Using a text editor, open the project file (.csproj, .vbproj, etc) of the project whose rules are to copied into another project.
2. Copy the section <CodeAnalysisRules> .......... </CodeAnalysisRules> from that file.
3. Using a text editor, open the project file (.csproj, .vbproj, etc) of the project INTO whom the rules are to be copied.
4. Replace the <CodeAnalysisRules> .......... </CodeAnalysisRules> section of this file by the information copied from the earlier project.
5. In case you don't see a <CodeAnalysisRules> .......... </CodeAnalysisRules> section insert the copied stuff as the last element in the <PropertyGroup Condition=" '$(Configuration)$(Platform)' == 'ReleaseAnyCPU' "> element block.

No comments: