How to: Set Code Analysis Properties for C/C++ Projects
You can configure which rules the code analysis tool uses to analyze the code in each configuration of your project. In addition, you can direct code analysis to suppress warnings from code that was generated and added to your project by a third-party tool.
Code Analysis Property Page
The Code Analysis property page contains all code analysis configuration settings for a project. To open the code analysis property page for a project in Solution Explorer, right-click the project and then click Properties. Next, expand Configuration Properties and select the Code Analysis tab.
Project Configuration and Platform
The Configuration list and Platform list lets you apply different code analysis settings to different project configuration and platform combinations. For example, you can direct code analysis to apply one set of rules to your project for debug builds and a different set for release builds.
Enabling Code Analysis
You can decide whether to enable code analysis for your project by selecting Enable Code Analysis For C/C++ on Build. In combination with the Configuration list, you could, for example, decide to disable Code Analysis for debug builds and enable it for release builds.
If your project contains managed code, you can decide whether to enable or disable Code Analysis by selecting Enable Code Analysis on Build.
Code analysis is designed to help you improve the quality of your code and avoid common pitfalls. Therefore, consider carefully whether to disable code analysis. It is usually better to disable rule sets or individual rules that you do not want applied to your project.
Developers frequently use tools to help develop applications quickly. These tools can generate code that is added to the project. You might want to see the rule violations that code analysis discovers in generated code. However, you might not want to see them if you do not want to maintain the code.
The Suppress Results From Generated Code check box on the General properties page lets you select whether you want to see code analysis warnings from managed code that is generated by a third-party tool.
If your project contains managed code, you can select the rules to apply in a code analysis by selecting a rule set from the Run this rule set list.