This project is read-only.

Removing Stylecop settings option in visual studio

Aug 17, 2010 at 12:35 PM
Any ideas on how I might accomplish this? I want to remove or block it's use - I'm trying to enforce settings via one settings file that sits in the root of our projects folder - so that all our company projects use the "defaults". I don't want anyone override these settings (on purpose or accidentally) by clicking on the stylecop settings option that appears in visual studio when you right click on a project. Even opening the window (and then cancelling) still creates a settings file at the project level, and this is bad. Of course this won't stop them from copying and pasting a settings file into the project folder in windows, but this requires more thought, so that should be enough of a deterrent.
Aug 17, 2010 at 3:09 PM

Sure, that's easy enough to do.

What you do is you place an empty Settings.StyleCop file in every project directory.  I assume you've already got one in the solution directory.

Then you deny all source control contributors from having Check In or Check Out privlidges on every Settings.StyleCop file.

Voila! Every project has unmodifiable StyleCop settings!


Aug 17, 2010 at 3:15 PM
thinking outside the box, I like it :)
Aug 17, 2010 at 4:36 PM

Unexpected StyleCop settings may be not the only thing you could want to disallow in your source control.

So another the way is to have some "checker" included into the build process (you're using it, aren't you?) which would not allow building until all your rules are complied.
E.g., in our company we have own-written "checker" that checks tens of conditions, like project settings, project structure, files included into project and many more...


Best regards,
Oleg Shuruev