Search code examples
teamcityfxcopfxcopcmd

Exclude rules from FXCop via command line


Was using the MSBuild task a while back, and found some documentation about being able to exclude specific rules, e.g. -Microsoft.Design#CA2210. The MSBuild task translates that into /rule:-Microsoft.Design#CA2210.

We are now using the FXCop build runner in TeamCity, and adding that parameter into additional command line parameters is failing:

Failed to load rules file '-Microsoft.Design#CA2210;-Microsoft.Design#CA1020': Unable to find the specified file.

It seems that this argument is to specify the rulesets, and not individual rules. Can this be done?


Solution

  • There is an undocumented switch in fxcopcmd /rid:

    You can exclude via: /rid:-Microsoft.Design#CA2210 /rid: etc