views:

2099

answers:

2

I'm using StyleCop. But there a couple of rules I want to ignore, for instance using this. in front of class members.

How do I turn off a StyleCop rule. I've looked but can't find how to do it.

+10  A: 

In you StyleCop install, there's a Settings.StyleCop file. You can edit this to turn off rules globally. Drag that file onto the Settings Editor executable in that file to edit it.

You can also put copies of the settings file into your projects to override the global settings.

If you're using Visual Studio integration and not just MSBuild integration, you should be able to get to the settings editor on a per-project basis by right clicking on your project and choosing "StyleCop Settings" or something like that.

bdukes
A: 

Hi,

Here is a problem with specific StyleCop configuration.

I've got a total of two Settings.StyleCop files in my Visual Studio .Net solution folders.

The first is placed at the folder root with chosen rules for the team.

As I want to disable some rules for a specific project, I've put another Settings.StyleCop file in the corresponding project folder.

The results are: - when launching analysis from Visual Studio IDE (Run StyleCop), the project specific file is considered and no violation occurs. - when launching analysis from StyleCopCmd (command tool) the project specific file seems to be ignored and some violations occur. - when launching analysis from MSBuild target the project specific file seems also to be ignored and some violations occur.

Did I miss something with StyleCop configuration to have different results from ?

I'm using: Windows XP StyleCop 4.3 MSBuild 3.5 SP1 MSBuild Extension Pack 3.5.0.0 StyleCopCmd 0.2.1.0

Regards,

Olivier.

Olivier
This needs to be a separate question; it is definitely _not_ an answer to the above question
bdukes
OK, I'll post this question on a new subject
Olivier