Creating Custom Code Analysis Rule Sets


This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, use the version selector at the top left. We recommend upgrading to Visual Studio 2019. Download it here

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.

In This Section

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.

See Also

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