Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fxcop custom rules - Avoid having more than one class per file

Tags:

c#

fxcop

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

like image 456
Tim Avatar asked Nov 23 '09 15:11

Tim


1 Answers

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)

like image 88
SLaks Avatar answered Nov 06 '22 16:11

SLaks