How to: Run legacy code analysis manually for managed code
Applies to:
Visual Studio
Visual 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
The code analysis tool provides information to you about possible defects in your source code. You can run code analysis automatically with each build of a code project, and you can also run code analysis manually. The rules that are checked when code analysis is run are specified on the Code Analysis page of the project property pages. For more information, see How to: Configure Code Analysis for a Managed Code Project.
To run code analysis manually
- If you are on Visual Studio 2019 version 16.5 or later, execute the following command on command prompt before starting Visual Studio:
setx EnableLegacyCodeAnalysis true
In Solution Explorer, click the project.
On the Analyze menu, click Run Code Analysis on Project Name.