Analyzing Managed Code Quality by Using Code Analysis

You can use Code Analysis in Visual Studio Premium and Visual Studio Ultimate 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.

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.

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.

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.

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.