How to: Configure Code Analysis for a Managed Code Project
In Visual Studio Premium and Visual Studio Ultimate, you can choose from a list of Code Analysis rule sets to apply to a managed code project. The default rule set is the Microsoft Minimum Recommended Rules. You can apply another rule set to a project or to all projects in a solution.
For information about how to configure a rule set for ASP.NET Web applications, see How to: Configure Code Analysis for an ASP.NET Web Application.
To configure a rule set for a .NET Framework project
In Solution Explorer, click the project.
On the Analyze menu, click Configure Code Analysis for ProjectName.
In the Configuration and Platform lists, click the build configuration and target platform.
To run code analysis every time the project is built using the selected configuration, select the Enable Code Analysis on Build (defines CODE_ANALYSIS constant) check box. You can also run code analysis manually by opening the Analyze menu and clicking Run Code Analysis on ProjectName.
By default, code analysis does not report warnings from code that is automatically generated by external tools. To view warnings from generated code, clear the Suppress results from generated code check box.
This option does not suppress code analysis errors and warnings from generated code when the errors and warnings appear in forms and templates. You can both view and maintain the source code for a form or a template.
In the Run this rule set list, do one of the following:
Click the rule set that you want to use.
Click <Browse...> to specify an existing custom rule set that is not in the list.
Define a custom rule set.
For more information, see Creating Custom Code Analysis Rule Sets.