tags:

views:

114

answers:

1

I have just discovered sylecop and am running it through my projects, I have disabled certain rules such as usings must be within the namespace. However visual studio auto generated event handlers for say a button click are in the form btnOk_Click(....

This as I understand it doesn't conform to stylecop default settings as they should start with an upper case letter as with any method. But it has always appeared to be standard to me in code examples and so on. I am also used to this format for event handlers so is there a way to exclude event handlers from this validation but leave other methods being validated?

+1  A: 

The problem you’ll find with StyleCop is that the rules are not entirely consistent with either the Visual Studio defaults or much of the Microsoft code you’ll find. You’ve really only got two options with StyleCop:

  1. Turn rules off as you’ve already mentioned
  2. Write your own rules

Unfortunately there is no mechanism in the current version of StyleCop to make rules conditional.

Troy Hunt