views:

501

answers:

3

I want to create extra rules in FXCop. Custom Rules to help ensure specific best practices like checking against inline sql.

I'm really looking for good resources and examples. Thanks!

+3  A: 

This tutorial seems really comprehensive.

HTH, Kent

Kent Boogaart
A: 

You can also use the tool NDepend to write your custom rules and/or harness some of the 200 default rules. The cool fact about NDepend is that it comes with a dedicated and seamless language to write your own rules: 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 NbLinesOfCode > 20

Patrick Smacchia - NDepend dev
NDepend is cool, but not free...
Martinho Fernandes
A: 

The tutorial above is pretty good. I knocked together a sample VS project that also might be useful, since I couldn't find any example projects http://www.doogal.co.uk/files/FxCopRules.zip

Doogal