Condividi tramite


How to: Enable and disable binary code analysis for managed code

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

You can configure legacy code analysis (binary analysis) to run after each build of a managed code project. You can also have different settings for each build configuration, for example, debug and release.

Note

Legacy analysis is not available for newer project types such as .NET Core and .NET Standard apps. These projects use .NET Compiler Platform-based code analyzers to analyze code, both live and at build time. For information about disabling source code analysis in these projects, see How to disable source code analysis.

To enable or disable legacy code analysis:

  1. In Solution Explorer, select and hold (or right-click) the project, and then select Properties.

  2. In the properties dialog box for the project, go to the Code Analysis tab.

  3. Specify the build type in Configuration and the target platform in Platform. (Non-.NET Core/.NET Standard projects only.)

  1. To enable or disable automatic code analysis, select or clear the Enable Code Analysis on Build check box.

Note

Disabling binary code analysis on build does not affect .NET Compiler Platform-based code analyzers, which always execute at build if you installed them as a NuGet package. For information about disabling analysis from these analyzers, see How to disable source code analysis.