How to: Enable and Disable Static Analysis for Database Code

To help developers catch design and performance issues, you can configure your database project so that static code analysis is automatically run after any team member successfully builds the project.

For each rule, you can specify whether to treat warnings as errors. If you do this, any code analysis errors will cause the build to fail.

In addition, you can also run the analysis manually. For more information, see Analyzing Database Code to Improve Code Quality.

To enable or disable code analysis for a database project

  1. Open the solution that contains your database project.

  2. In Solution Explorer, click the database project for which you want to enable or disable static code analysis.

  3. On the Data menu, point to Static Code Analysis, and click Configure.

    The project properties window opens, displaying the Code Analysis tab.

  4. In the Configuration list, click the configuration for which you want to enable or disable static code analysis when the project is built.

  5. If you want static code analysis to run after every successful build of the database project, select the Enable Code Analysis on Build check box. Otherwise, clear the check box.

  6. On the File menu, click Save Selected Items or Save All.

See Also


How to: Enable and Disable Specific Rules for Static Analysis of Database Code

How to: Analyze Transact-SQL Code to Find Defects

Walkthrough: Analyze Transact-SQL Code for an Existing Database


Analyzing Managed Code Quality by Using Code Analysis