Share via


CA0061

The rule 'RuleId' could not be found.

This error indicates that the specified rule could not be found.

This warning can be caused by an incorrectly formatted FxCopCmd.exe /RuleId option, an incorrectly formatted CodeAnalysisRules property value, or because the specified rule is in a rule assembly that FxCop is not using.

FxCopCmd /RuleId option

Use one of the following formats to specify a rule in the FxCopCmd.exe /RuleId option on the FxCopCmd command line:

  • FxCopCmd.exe /RuleId:-Category**#**RuleId

    where Category is the rule category and RuleId is the CheckId of the rule. For example:

    FxCopCmd /RuleId:-Microsoft.Design#CA2210
    
  • FxCopCmd.exe /RuleId:-Namespace**#**RuleId

    where Namespace is the rule category and RuleId is the check id of the rule. For example:

    FxCopCmd /RuleId:-Microsoft.Rules.Design#CA2210
    

MSBuild CodeAnalysisRules property

In Visual Studio code analysis, rules can be specified by using the CodeAnalysisRules property of MSBuild with the following format:

<CodeAnalysisRules>-{Category|Namespace}#RuleId[;...]</CodeAnalysisRules>

For example

<CodeAnalysisRules>-Microsoft.Design#CA2210;-Microsoft.Rules.Managed.CA1062</CodeAnalysisRules>

See Also

Concepts

Resources for Troubleshooting Errors in Application Lifecycle Management Tools

Other Resources

Code Analysis Application Errors