Recently I faced an issue setting up stylecop to a new project in a solution.
Here is the problem statement:
In my solution StyleCopSettings has a Rule (UsingDirectivesMustBePlacedWithinNamespace) which is disabled but when I build the solution in release mode, I still see stylecop error saying Using directives must be inside the namespace.
<Analyzer AnalyzerId="StyleCop.CSharp.OrderingRules">
<Rules>
<Rule Name="UsingDirectivesMustBePlacedWithinNamespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
The solution to this is to add a Stylecop settings file in the project to point to the one in the solution. This helped resolving the issue:
<StyleCopSettings Version="105">
<GlobalSettings>
<StringProperty Name="LinkedSettingsFile">..\..\SolutionSettings.StyleCop</StringProperty>
<StringProperty Name="MergeSettingsFiles">Linked</StringProperty>
</GlobalSettings>
</StyleCopSettings>