FXCOP integrator with Visual Studio 10 Custom Rule

Oct 3, 2012 at 1:52 PM

I have tried creating a custom rule. When I try running the custom rule I am getting an entry in the CodeAnalysis.log.xml . I am not able to open the XML file in IE and can only open it in notepad. Here is a sample message from the xml file

 

<Messages>
<Message TypeName="AllTypeNamesShouldEndInFoo" Category="CustomRules.Naming" CheckId="CR1000" Status="Active" Created="2012-10-03

12:07:53Z" FixCategory="Breaking">
<Issue Certainty="100" Level="Warning">The name of type badlyCodedClass does not end with the suffix 'Foo'. Add the suffix to the

type name.</Issue>
</Message>

Am I missing any tags .   For FXCOP integrator are they any madatory tags . Does anyone have a sample FXCOP custom rule working with FXCOP integrator ?

Oct 7, 2012 at 2:23 PM

Looks like I found a solution:

The custom FXCOP dll must be placed into two "Rules" folder 1) FXCOP (Rules folder when you install fxcop)   2) Visual Studio - The Rules folder present in Visual Studio professonal.

The ruleset picks up rules from the Visual Studio folder. While FXCOP integrator picks the rules from the FXCOP folder . Unless you have the dll in both the rules folder you will not be able to use the custom rule.