Search code examples
continuous-integrationteamcityfxcop

Using TeamCity to run Fxcop against my old and gnarly solution generates too many errors


How can I have Fxcop run by TeamCity limit itself to looking at fewer rules?

I don't want to use a .fxcop project as that means I would need to curate which .dlls are used in analysis rather than a wildcard in the teamcity build step.


Solution

  • You have three basic options is you really want to disable some rules entirely:

    1. (FxCop 10.0 only) You could use a ruleset, which you should be able to specify using the additional command line options for fxcopcmd.exe in TeamCity.
    2. You could use the /ruleid command line switch to specify rules to exclude.
    3. You should be able to use a .fxcop project file that contains no targets along with a target assembly switch for the command line. (Given lodkin's response, it sounds like you would need to specify the .fxcop file via the additional command line options if you want to use TeamCity's wildcarded assembly list.)

    If you don't want to risk introducing new violations of these rules (which have apparently been broken so frequently in the past), you may want to consider suppressing the old violations instead of disabling the rules entirely. If so, one approach would be to add the suppressions to an .fxcop project file (used as in #3 above) with a note that indicates that they are "backlog" or "legacy" violations. This can be done in a single step from the FxCop UI and would allow you to keep these suppressions separarate from the "real" suppressions indicated via SuppressMessage attributes in your source code.