Am I understanding how StyleCop and the Resharper plug-in work?

Aug 31, 2011 at 12:27 PM

First off, great piece of software, thanks for contributing to the higher quality code effort.

Now to my question/observation.  I am using StyleCop 4.5.25, Resharper 5.1 and Visual Studio 2010 Ultimate edition.

I am trying to use a single settings file to manage StyleCop settings at both compile time for command-line building with msbuild, and also during real time code entry (the Resharper behavior). 

  1. Are the settings in the Settings.StyleCop files supposed to be independent of the StyleCop for Resharper behaviors and settings listed under Inspections Severity in the Resharper Options dialog?  The values in the settings file are just two valued: enabled/disabled but the values int the dialog range from 'do not show' to 'error' - 5 separate values in total.  I am asking this because it's not clear to me from the documentation.  I have been trying to understand the interactions of the two projects which are now combined into one.  
    1. The settings from the .StyleCop file are not reflected in the Inspections Severity area, and the changes I make in the Inspections Severity dialog don't seem to be taken into account if I run StyleCop (right click on the project and select StyleCop) nor do they come up as I change code (as expected a la Resharper plugin).
    2. The changes I make in the Inspections Severity dialog area are not saved to the Settings.StyleCop file, but rather to the UserSettings.xml settings file that Resharper uses.
  2. In order for changes to the Settings.StyleCop file to take effect I need to restart Visual Studio - is this expected behavior?


Sep 7, 2011 at 8:07 PM

Answering my own question here.  What I found/have come to realize is that the Settings.StyleCop file turns on or off specific rules, whereas the Inspections Severity area determines how the rule breaking is displayed by Resharper when it is enabled.