#223 – Enabling Code Analysis for Your Project

If you’re using Visual Studio 2010, the Ultimate and Premium versions come with a built-in code analysis tool, which allows you to check your code for potential problems.  Code analysis will check your code at the time that you build it, looking for logic errors or common mistakes.

To turn code analysis on at build-time, do the following.  Right-click your project in the Solution Explorer and select Properties.

Click on the Code Analysis tab.

Check the box labeled Enable Code Analysis on Build.

The next time that you build your project, the code analysis tool will check it for the problems covered by the Microsoft Basic Correctness Rules rule set.  Any problems found will be reported as Warnings in the Error List window.