I'm using Resharper 7.1 and StyleCop 4.7 (with Visual Studio 2012). By default Resharper loads all the StyleCop rules for inspection and for all off them the action to be taken is "Warning", even though in the Settings.StyleCop file some of the rules are disabled.
If a certain StyleCop rule is disabled I would like Resharper to "Do not show" anything (because of course, not all the default rules make sense all the time).
I know this can be done manually in the Resharper - Options - Inspection Severity, by choosing yourself what action to take for each rule. But is there a way to do this automatically? That is, make resharper not warn you about a rule being broken if it's disabled in Stylecop.Settings?
It makes sense to do this automatically, because I want to define a set of mandatory rules for all team to apply, and it would be redundant to have each engineer manually fix the action taken for each existing rule (since they are a lot).
Thanks in advance, Mihai
If you are on Windows, 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.
The stylecop feature doesn't work with Visual Studio 2022 . The Compatible versions are Visual Studio 2012, 2013, 2015, 2017, 2019 . Please try to always add a source to statements like this (even if it is obviously correct in this case 😉).
Open a project in your Visual Studio. Right-click on the project file in the explorer solution panel, and then click on StyleCop Settings... to open the configuration window as shown in the following screenshot: Once you have finished selecting the rules you need, you can launch your first analysis of code.
It seems there is no way to do this, although, it is possible to configure the rules manually in Resharper options and then export your options (via Manage -> Export to File) and they can be imported on other machines.
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