Visual Studio Code Analysis vs StyleCop + FxCop
I used previously StyleCop + FxCop on my Visual Studio's projects. But now I am testing Visual Studio Code Analysis tool, which is easier to integrate into MSBuild, and I have found that this tools analyses some of the rules of both FxCop and StyleCop.
Is this tool a full replacement for both FxCop and StyleCop or does it just implement some of their rules?
Solution 1:
Visual Studio includes FxCop + more.
From the developer blog of FxCop:
Sorry about my ignorance, but I assume FxCop is completely separate from the Code Analysis in VSTS? More specifically, I assume that if I install the new version of FxCop, VSTS will not take advantage (no shared code?)? If this is the case, any idea when these changes will make it into VSTS code analysis? Thanks!
That's correct, they are different products, however they do have a common engine. Visual Studio 2008 SP1 already comes with the same fixes and analysis (plus a little bit more), so there is no need to 'update' Visual Studio with the latest FxCop.
A developer blog also gave the exact rules which are in each.
As for StyleCop, it's independent of VS Code Analysis as described in this blog post, which links to Jader Dias' post.
Solution 2:
My understanding is that Visual Studio Code Analysis is basically a slightly modified version of FxCop. From my experience they are almost the same thing (in fact I believe Code Analysis uses the FxCop executable behind the scenes).
Although there is overlap between FxCop/CodeAnalysis and StyleCop; FxCop tends to focus more on design rules and StyleCop is focusing on coding style (casing, white space, indents, etc).
Also FxCop analyzes the IL while StyleCop analyzes the source code directly. This imposes a different set of restrictions on what rules they can each enforce.
Solution 3:
Until now my googling resulted in the following answer:
http://blogs.msdn.com/bharry/archive/2008/07/19/clearing-up-confusion.aspx
states:
"We found that StyleCop is, in fact, a very useful tool and it does things FxCop and TeamDev doesn't do (and it doesn't do the things they do). It is a wonderful complementary tool. StyleCop is a tool for doing coding style checking to verify that source code is formatted the way you want and follows the style guidelines for conventions. While there is some overlap with FxCop (like checking identifier capitalization), the overlap is miniscule as StyleCop does not do the deep analysis that the other static analysis tools do to enable code correctness checks, security checks, etc."
But I'm not sure if the "TeamDev" is the same thing as "Visual Studio's Code Analysis"