Hi all,
as fxcop is an assembly inspector, is it possible to create a custom rule that check if there's more than one class per file ?
If yes, how to do that ?
Thanks for your help
Hi all,
as fxcop is an assembly inspector, is it possible to create a custom rule that check if there's more than one class per file ?
If yes, how to do that ?
Thanks for your help
It is not possible to do that. Since FxCop only inspects binaries, it is impossible to tell which file a class was defined it.
However, look at StyleCop, which comes with such a rule out of the box. (SA1402: FileMayOnlyContainASingleClass)
As you say yourself: FxCop checks the compiled assemblies. Thus, there simply isn't something like a sourcecode file anymore. So the answer is no.
But MS StyleCop (quite similar to FxCop, but analyzing sourcecode files rather than IL code) might be able to do what you want. I don't know, if such a StyleCop rule already exists - if so, it's definitely not in the set of rules that come with StyleCop "out of the box" (i.e. the MS predefined ones...).
HTH!
EDIT: I've seen at the moment, that there actually IS such a rule (see answer above)...
My thinking...
Sorry I don't know how to read info from the pdb file.