SourceFileList SourceFile entries do not allow for folders

Jan 11, 2015 at 4:46 PM
I am trying to use the StyleCop.Settings file to exclude specific files from the build process. I am having an issue specifying files within folders.

In my example project, I have two files:
  • More/Class1.cs
  • Program.cs
If I attempt to specify Class1.cs by using a project relative path, it is not excluded from StyleCop's evaluation of the code.
  <SourceFileList>
    <SourceFile>More/Class1.cs</SourceFile>
    <SourceFile>Program.cs</SourceFile>
    <Settings>
    <GlobalSettings>
      <BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
    </GlobalSettings>
    </Settings>
  </SourceFileList>
However if I only specify the file's name, the file is excluded:
  <SourceFileList>
    <SourceFile>Class1.cs</SourceFile>
    <SourceFile>Program.cs</SourceFile>
    <Settings>
    <GlobalSettings>
      <BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
    </GlobalSettings>
    </Settings>
  </SourceFileList>
For a code base of any size, this does not seem adequate as class name collisions are bound to occur if filepath specification is not allowed.

Is there a way to refer to specific files using SourceFile elements?

Thank you!