For Visual Studio 2008, we have added a new MSBuild property that allows you to easily treat all Code Analysis warnings as build errors. This can be useful for example, if you want to force that any firing of a Code Analysis rule to break the build during a nightly Team Build without needing to individually set this for every rule.

To use, simply add the <CodeAnalysisTreatWarningsAsErrors> property to your project file (or a common targets file) and set it to true:

CodeAnalysisTreatWarningsAsErrors MSBuild property

Now, in the next run of Code Analysis, all rules will be displayed as errors:

Error List with Code Analysis errors