locked
FxCop rule for Avoiding multiple Main() methods in a single assembly.

    Question

  •  

    Hi,

    I am  quite new to FxCop

    Could any one guide me for the following rule

    Avoid multiple Main() methods in a single assembly.

     

    Thanks in advance.

    -Regards

     

    Monday, February 25, 2008 1:26 PM

Answers

  • Not sure exactly what you are looking for as although you can have multiple methods named 'Main', only one will ever be considered as the actual entry point.

     

    To write this rule, simply override Check(Member), check if it a method (via Member.NodeType) and then see if its name (Member.Name.Name) is 'Main'.

     

    Regards

     

    David

    Monday, February 25, 2008 6:26 PM