Recently I had started using FxCop,which is a wonderful code analysis tool.Soon after getting into it,I felt the need of rules specific to my requirements and standards.One such need was in the area of ‘Naming of Variables’.
Every project/organization might have their own naming standards and rules for variables. FxCop provides a way to make sure everyone in the team adheres to these rules.
I found this material quite interesting and helpful.
FxCop And Code Analysis
FxCop analyzes the CIL( Common Intermediate Language) ,so it is supposedly to be language independent.The CIL genarated by the vb compiler and the c# compiler are almost same,but there are diferences which needs to be handled and taken care of while writing custom rules.
One such example i faced in checking for naming convention of string variables is posted here.
You can always see the CIL genarated using the ‘ildasm’ tool which comes with visual studio.
It would be helpful ,if you look at the IL genarated while writing rules,as writing rules is always a trial and error method.
One other tool which comes handy is Reflector.
Will soon post more on writing custom rules.Hope this helps to start with!!!!