We recommend using Visual Studio 2017

Creating Custom Code Analysis Rule Sets


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Creating Custom Code Analysis Rule Sets.

You apply code analysis rules to a managed code project by specifying a rule set that contains one or more rules. The Microsoft standard rule sets provide groups of rules that are organized by function and depth. For example, the Microsoft Basic Design Guidelines Rules and the Microsoft Extended Design Guidelines Rules contain rules that focus on usability and maintainability issues, with added emphasis on naming rules in the Extended rule set.

You can also create a custom rule set that combines two or more standard rule sets or that specifies rules in one or more standard rule sets. You save custom rule sets to a .ruleset file, and you can specify them in multiple code projects.

How to: Create a Custom Rule Set
Describes how to create a custom rule set by modifying one or more standard rule sets.

Working in the Rule Set Editor
Describes how to use the rule set editor to group, sort, filter, and modify code analysis rules in a custom rule set.

Code analysis rule set reference
Analyzing Managed Code Quality
Analyzing C/C++ Code Quality by Using Code Analysis