Question

I work with stylecop and find it very helpful. However i would like a different set of rules for my test projects than my normal c# class libraries.

Is this possible?

For example, I don't want my methods having an underscore in them in normal libraries but its ok in my test projects. So my IDE should alert me of rule violation in normal projects but not in test projects for such.

Follow on from this is that I would like similar as part of my msbuild tasks.

Was it helpful?

Solution

StyleCop is configurable per project. Right-click on a test project, select StyleCop settings, and disable the underscore rule for your test project.

What you can do then is keep all your test projects in a sub-folder, e.g. test/ (on the disk, not solution folder) and move the Settings.StyleCop file up from the project folder to the test/ folder. Now you can share the one settings file between all your test projects.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top