Udostępnij za pośrednictwem


How to: Enable and Disable Code Analysis for Managed Code

The code analysis feature for managed code checks assemblies for conformance to the Microsoft .NET Framework Design Guidelines.

To enable code analysis for managed code

  1. Select a project in Solution Explorer.

  2. On the Project menu, click <project name> Properties.

  3. Click Code Analysis.

  4. Select Enable Code Analysis on Build (defines CODE_ANALYSIS constant).

To enable code analysis for managed extension for C++ code

  1. Select a project in Solution Explorer.

  2. On the Project menu, click <project name> Properties.

  3. Expand Configuration Properties and expand Code Analysis.

  4. Set Enable Code Analysis For Managed Binaries on Build to Yes.

To disable code analysis for managed code

  1. Select a project in Solution Explorer.

  2. On the Project menu, click <project name> Properties.

  3. Click Code Analysis.

  4. Clear Enable Code Analysis on Build (defines CODE_ANALYSIS constant).

To disable code analysis for managed extension for C++ code

  1. Select a project in Solution Explorer.

  2. On the Project menu, click <project name> Properties.

  3. Expand Configuration Properties and expand Code Analysis.

  4. Set Enable Code Analysis For Managed Code to No.

See Also

Other Resources

Design Guidelines for Class Library Developers