Defining common fxcop ruleset for all projects/solutions/configurations

 

User wants to configure a common set of fxcop rules and use them for all projects/solutions. Does he need to configure the common set for every new project/solution/configuration?

 

No. User need to override the "CodeAnalysisRules" property to include the common rules he wants to use across the projects/solutions/configurations. He can define the property in the tfsbuild.proj file. Defining the property in this file will override the project specific value of this property (defined in *.csproj).

 

For more details about Static Analysis in Team Build, refer this post.

Disclaimer: I have not tried this fix myself but it should work.

Comments

  • Anonymous
    December 27, 2005
    The comment has been removed

  • Anonymous
    January 01, 2006
    Jim,

    1) There is no global tfsbuild.proj file. This file represent the build configuration for only one team project. If you want to share the settings for multiple team projects, you have to do the customization seperately for the build type (tfsbuild.proj) for each team project. We might allow working across different team projects in next version but I can not comment on it now.

    2)CodeAnalysisRules property is defined in the .xxproj files for the solutions. Since this file was created automatically by the VS, your manualy modification can create problems. Moreover it is not a good idea to make changes in this file because any other user who is not using teambuild will also get your customization. If you redefine this property in the tfsbuild.proj file, then msbuild will ignore the value set in .xxproj file and will use the one specified by you (in tfsbuild).

  • Anonymous
    January 02, 2006
    Thanks very much for your answers Manish. I hope you don't mind if I ask one more:

    1. One of my goals is to define a subset of FXCop rules including some custom rules that would be the set of rules that a set of code must pass before being checked in and/or deployed to production. What approach do you suggest to accomplish this goal?

    Thanks again,
    Jim

  • Anonymous
    January 03, 2006
    Jim, I am not very clear about your query. It looks like you want to set/invoke some set of custom fxcop rules before checkin (files).

    Two points to note
    1) If you want to selectively run rules for some projects and avoid others, you have to make changes in the corresponding csproj files. Rules in tfsbuild will be applicable to all slns and projects. An alternative is to use "Conditional definition of properties" but it is not scalable approach.

    2) Team Foundation already has concept of "checkin policies" in version control. You might want to set your own fxcop rule.

    Moreover this is not related to build process in general.



  • Anonymous
    September 19, 2007
    I am using Visual Studio Team Suite and I want to anlyse Fxcop vs. Static Code Analysis. When I enable Code Analysis in Visual Studio project and make changes to the rules, I don't see the changes taking effect when I run the code analysis!!! i.e I don't see the errors that I ahve enabled and changed from warning status and also I have introduced an change in my code to reveal this error.

  • Anonymous
    June 19, 2009
    PingBack from http://debtsolutionsnow.info/story.php?id=557