Automatically select the correct CodeAnalysis rule set

We have a number of major solutions and many rule files based on different types of projects. For example, we have:

  • Sharepoint Rulesset containing:

    • All Microsoft Rules
    • MSOCAF Rules
    • SPDisposeChecker Rule
    • A few custom rules
  • Test Project Rules Set

    • All Microsoft Rules
    • Disable multiple naming conventions (e.g. using underscores)
    • Several test specific rules similar to TypeMock TestLint
    • A few custom rules
  • Standard set of rules

    • All Microsoft Rules
    • A few custom rules

I would really like it if Code Analysis was able to automatically select the right set based on the type of project.

I have not found the perfect way to do this. What I will consider:

  • msbuild , (yuk)
  • CodeAnalayis (yuk)
  • , , . ()
  • , , ( , ).

:

  • .

...

+3
2

, . Msbuild, Microsoft, BeforeTargets Aftertargets Msbuild.

(, , , , , ), CodeAnalaysis.rules . , .

Sharepoint, , :

$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\SharePointTools\Custom.After.Microsoft.VisualStudio.SharePoint.targets

msbuild, $(CustomAfterSharePointTargets), , .

.

Visual Studio 11. .

+1

, , . , , ymmv...

, , - . , , ( ), , Visual Studio. , . , , ( "... " ).

+1

All Articles