Teambuild and static code analysis RRS feed

  • Question

  • Hi!

    Does anybody know a way to enable some of the static code analysis rules (about 10) in team build?
    We have a lot of old code so I don't want to use all the rules now. Because we're going to turn on one rule at the time I don't want to maintain code analysis in all the projects settings so having one place to turn this functionality one would be very nice.

    Friday, November 14, 2008 7:11 AM


  • 1. Set your CA rules for the project in the IDE.
    2. Open the project file in a text editor
    3. Copy the content of the CodeAnalysisRules property
    4. Add the content to the TeamBuild project file


            <SolutionToBuild Include="$(BuildProjectFolderPath)/../../YourProject">
                <Properties>CodeAnalysisRules=+!Microsoft.Design#CA1012;+!Microsoft.Design#CA2210 ..... and all the others you want</Properties>

    The problem with this approach is that your developers will only see CA errors when the team build runs, so you loose the value of the CA checkin policy. That said, it does provide the ability to ensure that no projects have incorrect settings....

    • Marked as answer by Kai H Friday, November 14, 2008 11:37 AM
    Friday, November 14, 2008 11:28 AM