0

I have two settings files in my project. One lies next to the Visual Studio solution file. The other one is in an subfolder which is used for export to other products we develop.

  • ...
  • solution.sln
  • settings.stylecop (linked to the other settings file)
  • Export (folder)
    • settings.stylecop (<= used for export, no merging)
    • stylecop.targets
    • stylecop.dll
    • etc...

When I link the sln settings file to the one in the export folder StyleCop has all rules activated. It seems that the linking is ignored. But when I open the sln settings file in the editor it seems that the setting are inherited.

What have I made wrong? Now I have to manually ensure that both files are always identical.

Antineutrino
  • 1,093
  • 3
  • 10
  • 26
  • How do you perform the "linking"? – Daniel Hilgarth Feb 15 '13 at 08:33
  • I use the "Merge with the following settings file" in the settings editor. – Antineutrino Feb 15 '13 at 12:56
  • It's hard to understand what's the problem here. Could you show some screenshots or explain it based on a concrete setting? In which setting file is it set? In which it isn't? etc. – Daniel Hilgarth Feb 15 '13 at 13:02
  • The settings.stylecop file next to the solution has not rules explicitly set. It only uses the "Merge with the following settings file" function. The setting.stylecop file in the export folder hast rules defined. I expect that StyleCop now uses the settings file next to the solution. But since in this file is merging with the file in the export folder the rules specified there should be used. But actually StyleCop now seems to use no rules at all. – Antineutrino Feb 16 '13 at 15:08

1 Answers1

1

It sounds like your LinkedSettingsFile value is incorrect. To make sure that its value is treated as being relative to the settings file (and not the working directory of the executing process) it must start with a period. For example:

<StyleCopSettings Version="105">
  <GlobalSettings>
    <StringProperty Name="MergeSettingsFiles">Linked</StringProperty>
    <StringProperty Name="LinkedSettingsFile">.\SomeFolder\Settings.StyleCop</StringProperty>
  </GlobalSettings>
</StyleCopSettings>

There is some more information in this CodePlex issue.

Adam Brown
  • 332
  • 3
  • 10