2
votes

I want to use the StyleCop build runner plugin in TeamCity 7.1 to test StyleCop rules in my projects. Each project has its own StyleCop settings file and everything works when testing from Visual Studio.

However, when I run the build step from TeamCity, then StyleCop uses some other settings and many errors occur.

Why doesn't StyleCop in TeamCity take the StyleCop settings from my projects?

1

1 Answers

3
votes

By default your settings files are merged into parent settings, and this could be causing you some issues. Try stopping the merging at the solution root by adding the following setting:

<GlobalSettings>
    <StringProperty Name="MergeSettingsFiles">NoMerge</StringProperty>
</GlobalSettings>

This will ensure that StyleCop acts the same on all development and build machines, regardless of the settings configured higher up the hierarchy (such as the one in the StyleCop application folder). However if you do this, make sure you copy all the required settings from the files no longer being merged.