R#7 + Style Cop 4.7 and Settings.StyleCop

Oct 10, 2012 at 1:50 AM
Edited Oct 10, 2012 at 1:50 AM

We're in the process up updating our development environment to R# 7.0.1098.2760 and Style Cop 4.7.41.0 from R#6 and Style Cop 4.6 and ran into an issue with the Settings.StyleCop and aren't sure if this is an issue or not.

We have stored the entire Style Cop folder within each TFS branch for some time to simplify building on both DEV and automated build servers. Our latest branch has been updated to 4.7 and initially received a whole bunch of Style Cop errors. But we realized that Style Cop wasn't adhering to the settings stored within our branch but was clearly using the default Settings.StyleCop stored in the  C:\Program Files (x86)\StyleCop 4.7 directory. As an experiment, we copied the modified Settings.StyleCop file from the branch path into the Program Files directory and no longer received any errors.

We're not that familiar with the R#/StyleCop integration but can clearly see a "StyleCop location" option within the R# Options window and it's pointing to the Program Files directory. Our assumption all along is that developers would have to browse to our custom Style Cop directory located within the branch to keep the rules in-sync, so to speak, but this wouldn't have any effect with how Style Cop and MSBuild integrate. The experiment above, however, suggests otherwise.

I should also mention that our projects point to a custom StyleCop.Targets file located within the branch and the "UsingTask" was modified to use the StyleCop.dll also located in the branch...

<UsingTask AssemblyFile="$(MSBuildThisFileDirectory)\StyleCop.dll" TaskName="StyleCopTask" />

What would we need to do for StyleCop 4.7 to use the custom Settings.StyleCop located somewhere other than Program Files? Or does the R# integration somehow override what we have specified in our StyleCop.Targets file?