How to: Configure Code Analysis for an ASP.NET Web Application
This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, use the version selector at the top left. We recommend upgrading to Visual Studio 2019. Download it here
In Visual Studio Premium and Visual Studio Ultimate you can select from a list of Code Analysis rule sets to apply to ASP.NET Web application. The default rule set is the Microsoft Mininimum Recommended Rules. You can select another rule set to apply to the Web site.
To configure a rule set for an ASP.NET Page Framework project
Select the Web site in Solution Explorer.
On the Analyze menu, click Configure Code Analysis for Web Site.
If you selected the solution and the solution has more than one project, select the build configuration and target operating system from the Configuration and Platform lists.
For each project in the solution, click the Rule Set column, and then click the name of the rule set to run.
By default, code analysis is run on all projects in the solution. To disable or enable code analysis for a particular project, follow these steps:
Right-click the project name and then click Properties.
Check or clear the Enable Code Analysis check box. You can also run code analysis manually by selecting Run Code Analysis on Web Site from the Analyze menu.
In the Run this rule set drop-down list, follow these steps:
Select the rule set that you want to use.
Select <Browse> to specify an existing custom rule set that is not in the list.
Define a custom rule set. For more information, see Creating Custom Rule Sets.