June 14th, 2009

Astronaut

FxCop: breaking the build, with useful warnings

Visual Studio Team System includes Code Analysis, an integrated tool that will analyse your .NET assembly once you’ve built it, and identify a range of common problems (specifically, ways in which your code doesn't meet the Framework Design Guidelines). These can raise warnings or even errors as part of the build process.

If you have a less capable (cheaper) edition of Visual Studio, then all you have is Code Analysis’ little brother, FxCop. FxCop is not integrated into Visual Studio, and has to be run as a separate tool.

It would be nice to be able to use FxCop to generate warnings as part of the build, and even make the build break if any warnings occur. After a bit of a look around this weekend, I found that although bits of the solution were out there, some of them were a bit complex and there wasn’t one simple recommendation that would do just that.

Collapse )