FxCops is something new to me, but as always I would like to get to know the new things..
From what I've read, FxCops is already included in VS2008. I guess it's the "Code Analysis" function. Whenever I try to run it though, it seems to start a rebuild and end in the "Finished Rebuilding" state.
I checked the output window and there are a bunch of warnings there. But if I'm not mistaking, there should be more of a GUI for this then the wall of text in my output window, right?
Am I missing a window that should have popped up? Can I open it somewhere? Or is there anything else I'm missing?
views:
925answers:
4Yes, Code Analysis is the nice friendly name for FxCop. However, I'm not aware of a friendly window beyond the errors / warning list where they should appear, prefixed CA
.
On the project properties screen there is a Code analysis tab where you can treat warnings as errors to enforce the rules you care about.
You're not missing anything - there isn't a pop-up window.
The list of issues in the output window is pretty much all you'd get in FxCop. It's just that FxCop is a standalone application.
Here's a decent article on FxCop and Code Analysis:
http://geekswithblogs.net/sdorman/archive/2008/08/19/visual-studio-and-code-analysis.aspx
You can also use the tool NDepend to write your rules and harness some of the 200 default rules. The cool fact about NDepend compare to FxCop, is that NDepend comes with a dedicated language to write your own rule: Code Query Language (CQL)
For example the following CQL rule will warn if it finds method with more than 20 lines of code:
WARN IF Count > 0 IN SELECT METHODS WHERE NbLinesOfCdoe > 20
As with FxCop, NDepend might generate tons of warning. The difference is that NDepend lets you specify a particular snapshot of your code base, and then do your analysis on the diff since this snapshot. Then you'll be advised of problem introduced since a particular date. More explanation about this feature can be found here: Ensure the quality of the code that will be developed this year
Just so everyone knows, because it took me a long time to figure this out.... Code Analysis / FxCop is only included in Team System and Team Suite versions of VS 2008, not in the Professional Edition.