How to: Enable and Disable Specific Managed Code Analysis Warnings

The managed code analysis tool allows you to select specific warnings from within the integrated development environment (IDE). This ease of use allows you to enforce only warnings that best meet your project needs. You can either choose a group of warnings or individual ones in a particular group.

Important

Avoid shipping release builds with code analysis enabled because enabling code analysis defines the CODE_ANALYSIS constant. This causes the SuppressMessage attributes to be emitted in the binaries and impacts performance.

To enable a specific managed code analysis warning

  1. Select a project in Solution Explorer.

  2. On the Project menu, click Properties.

  3. Click Code Analysis.

  4. Select Enable Code Analysis.

  5. Expand a rule node.

  6. Enable the specific warning by selecting the warning check box.

To disable a specific managed code analysis warning

  1. Select a project in Solution Explorer.

  2. On the Project menu, click Properties.

  3. Click Code Analysis.

  4. Expand a rule node.

  5. Disable the specific warning by clearing the warning check box.

See Also

Concepts

Guidelines for Using Code Analysis Tools