Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Stylecop to ignore a project in a solution?

When I choose Tools > Run Style Cop (Ctrl + Shift + Y) it runs StyleCop over all projects, even the one which are set to not build in the current solution configuration.

How to use this hotkey to check only the projects that I want?

like image 565
Jader Dias Avatar asked Jan 19 '12 13:01

Jader Dias


People also ask

How do I ignore a StyleCop warning?

Starting with StyleCop 4.3. 2, it is possible to suppress the reporting of rule violations by adding suppression attributes within the source code. The syntax for these suppressions is similar to that for Visual Studio Code Analysis, or FxCop.

How do I remove a StyleCop from my project?

right-click on a project in Project Explorer. select "StyleCop Settings" on the "Rules" tab of the dialog that opens, uncheck the "C#" root of the Enabled rules tree.

How do you change rules on StyleCop?

In your 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.


1 Answers

Check out the Disable stylecop analysis for specific projects within solution question at Disable stylecop analysis for specific projects within solution as I think this is what you are looking for.

To summarise, I managed to get this to work by adding the RulesEnabledByDefault global settings property to a Settings.StyleCop file which I put in the root folder of each project I did not want to be included in the StyleCop analysis.

<StyleCopSettings Version="105">
  <GlobalSettings>
    <BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
  </GlobalSettings>
</StyleCopSettings>

If you make use of merged settings files, you may also have to include the MergeSettingsFiles global settings property. For example:

<StyleCopSettings Version="105">
  <GlobalSettings>
    <StringProperty Name="MergeSettingsFiles">NoMerge</StringProperty>
    <BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
  </GlobalSettings>
</StyleCopSettings>
like image 103
JT_ Avatar answered Sep 18 '22 14:09

JT_