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?
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.
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.
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.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With