Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of StyleCop

Someone on our team installed StyleCop and since then all of the projects he loaded up and committed to source control refuse to load unless stylecop is installed.

I know I can manually edit the .csproj files to get rid of it, but is there an easy way to automatically remove these stylecop parts from the project files so they can be loaded and built on a non-stylecop-infected Visual Studio machine?

like image 223
gbjbaanb Avatar asked Dec 09 '10 14:12

gbjbaanb


People also ask

What is the use of StyleCop?

StyleCop analyzes C# source code to enforce a set of style and consistency rules. This extension allows analysis to be performed on any project opened in Visual Studio without modifying the project.

How do I open StyleCop settings editor?

The Settings. StyleCop file can be opened from the Explorer and edited through a GUI. If that doesn't work, try dragging the Settings file onto an application called StyleCopSettingsEditor.exe which is installed in your StyleCop Program Files folder.


2 Answers

Why remove it?
In my opinion using StyleCop is a good thing.
Your only problem seems to be that your team member didn't set up StyleCop properly.

From your description, I guess that he wanted to set up StyleCop with MSBuild integration: http://blogs.msdn.com/b/sourceanalysis/archive/2008/05/24/source-analysis-msbuild-integration.aspx

He apparently just left out the last paragraph "Team Development": copy the StyleCop files into your project and check them into source control, so you don't need to install StyleCop on every single developer machine. (see my link for a more detailed description)

If you do this, StyleCop should work on every machine, no matter if it's installed or not.

We are using StyleCop in this way as well, and I think it's the easiest way to use it.
I just had to insert two lines into each .csproj file and check a few files into source control once...and StyleCop just works, on every compile, on every machine (no matter if it's on a developer machine or the build server).

like image 151
Christian Specht Avatar answered Oct 16 '22 12:10

Christian Specht


Stylecop hides real warnings. Its a vanity exercise and its evil.

Do not use it.

I find that stylecop generates many many trivial warnings that drown out the real warnings. By all means use these tools but don't force them to be on. Having no stylecop warnings is a meaningless metric.

like image 32
Stephen Avatar answered Oct 16 '22 12:10

Stephen