Partilhar via


Analyzing Managed Code Quality by Using Code Analysis

Note

This article applies to Visual Studio 2015. 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 use the code analysis tools in Visual Studio to discover potential issues in your code, such as non-secure data access, usage violations, and design problems. Code analysis works on .NET Framework, native (C and C++), and database applications. Code analysis for managed code organizes rules in rule sets that target specific coding issues.

Common Tasks

Common Tasks Supporting Content
Get hands-on practice: Learn the basics of code analysis by correcting defects in a simple .NET Framework application. - Walkthrough: Analyzing Managed Code for Code Defects
Configure code analysis for a project: Rules for managed code are organized into rule sets that target specific areas, such as security and design. You can use one of the Microsoft standard rule sets or create your own. - Code Analysis for Managed Code Overview
- Using Rule Sets to Group Code Analysis Rules
- Suppress Warnings By Using the SuppressMessage Attribute
Run code analysis: You can specify code analysis to be run automatically every time that a project configuration is built, and you can run code analysis manually on a project. - How to: Enable and Disable Automatic Code Analysis
- How to: Run Code Analysis Manually
Analyze code analysis results: Code analysis warnings and errors are listed in the Code Analysis window. You can choose a warning or an error title to display additional information about the warning, and to display and highlight the source code line that fired the rule. You can choose the warning id to display detailed information in the MSDN Library that includes information and examples of how to resolve the issue. - How to: View Managed Code Defects
- Code Analysis for Managed Code Warnings
- Warnings By CheckId
- Anonymous Methods and Code Analysis
Integrate code analysis with your development life-cycle: Check-in policies in Team Foundation version control enable development teams to make sure that all code check-ins meet a common set of code analysis standards. Creating a work item for a code analysis rule violation is simple procedure that you can perform in the Error List window. - Enhancing Code Quality with Team Project Check-in Policies
- How to: Synchronize Code Project Rule Sets with Team Project Check-in Policy
- How to: Create a Work Item for a Managed Code Defect