Ross Watson

Hi,

sorry if this has been asked before, but I'm trying to find out about "coding standards enforcement", and have been asked to look at FXCop.

It would appear to be from Microsoft and that leads me to ask what the difference is between FXCop and the "Code Analysis" that seems to be built in to VS2005

There seems to be some (or complete) overlap, but nowhere seems to explain what the difference is and why one would choose one over the other.

I presume that we would need to write customised rules (maybe) but can't seem to see where that would fit in to either solution - although both seem to support it.

From a development team point of view, which is the easier to manage so that, for example, we don't have to select which rules to run on a per-project basis, and can ensure that the same set of (customised) rules are used by all the developers. Obviously, this sounds a bit like VS Team-server-whatever, so I presume that I also need to investigate what that offers.

Any guidance or pointers would be gratefully received.




Re: Visual Studio Code Analysis and Code Metrics FXCop vs. 2005 Code Analysis ?

Girish Chhabra

FxCop has been available from Microsoft on the GotDotNet.com site for several years. Previous versions of FxCop have been stand-alone applications, separated from the Visual Studio IDE.
With Team System, FxCop is now called the Managed Code Analysis tool, and is fully integrated with the IDE, enabling analysis to be performed with a simple build of your application. The FxCop heritage of Managed Code Analysis is generally hidden when you¡¯re using the IDE, but as you¡¯ll see, the FxCop name still appears when creating new rules and using command-line options.

By default, code analysis is disabled for projects in Visual Studio. To enable analysis, open your project¡¯s Properties window and select Code Analysis from the left-hand side tabs.





Re: Visual Studio Code Analysis and Code Metrics FXCop vs. 2005 Code Analysis ?

David M. Kean - MSFT

Ross,

This is a commonly asked question, and we will providing a detailed post on this on the FxCop Blog in the future.

A summary has been posted over here: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=300549&SiteID=1.

> I presume that we would need to write customised rules (maybe) but can't seem to see where that would fit in to either solution - although both seem to support it.

Visual Studio Code Analysis and FxCop both use the same engine. Both allow custom rules (see FAQ: Can I create custom rules that target both Visual Studio and FxCop ).

> From a development team point of view, which is the easier to manage so that, for example, we don't have to select which rules to run on a per-project basis, and can ensure that the same set of (customised) rules are used by all the developers

Visual Studio Code Analysis Policy does exactly that, it allow you to enforce a policy that ensures that code passes a specific set of rules before checking-in.

Visual Studio Code Analysis is definately the way to go, in the future it will be a superset of what is available in FxCop.

Regards

David






Re: Visual Studio Code Analysis and Code Metrics FXCop vs. 2005 Code Analysis ?

Nicklas Chapman

I've noticed that FxCop is rather more aggresive than Code Analysis. Particularly in its spell-checking. Is there a reason for the difference in the rules sets used by the two tools Are they likely to converge at any point

Cheers,





Re: Visual Studio Code Analysis and Code Metrics FXCop vs. 2005 Code Analysis ?

David M. Kean - MSFT

Visual Studio 2005 Code Analysis did not ship with any spelling checking rules. In Orcas this will change and Code Analysis will be a superset of the analysis available in FxCop.




Re: Visual Studio Code Analysis and Code Metrics FXCop vs. 2005 Code Analysis ?

dino.net

So, is Visual Studio 2005 Code Analysis going to be a free add-on for VS2005, same as FXCop has always been



Re: Visual Studio Code Analysis and Code Metrics FXCop vs. 2005 Code Analysis ?

David M. Kean - MSFT

Dino,

No, Visual Studio 2005 Code Analysis is not a free add-on. It ships with Visual Studio Team Edition for Developers.

However, FxCop will remain free.

For information on integrating FxCop with Visual Studio 2005, see the following post:

http://blogs.msdn.com/fxcop/archive/2007/02/24/faq-how-do-i-run-fxcop-during-a-post-build-event.aspx

Regards

David