This project is read-only.

SourceFileList versus ExcludeFromStyleCop

Jun 7, 2012 at 8:52 PM


What is the best approach?  From what I can see, you can do everything with a SourceFileList that you can with ExcludeFromStyleCop, so I am just wondering under what circumstances you would use one over the other.



Jun 13, 2012 at 7:23 PM

I was trying to decide between the two approaches for excluding legacy files and settled on using SourceFileList.  My main motivation was the fact that the SourceFileList approach didn't require making changes to the project files.  In addition, you could turn on specific rules for the legacy files if you use the SourceFileList approach.

Jun 17, 2012 at 8:06 PM

Hello Bruno,

Agreed, this is definitely a benefit to using SourceFileLists.

I would still be interested to hear what the developers have to say about this though.


Jun 18, 2012 at 11:08 AM
Edited Jun 18, 2012 at 2:09 PM
There's a doc on adding stylecop to a project that has lots of violations.
In some engineering groups you may not have the ability to add entries into the csproj files.
Personally, to exclude 1 or 2 files I'd edit the csproj and exclude them.
Jun 18, 2012 at 12:41 PM


Is this the one that you are referring to:

If so, it mentions to use the ExcludeFromStyleCop method.  However, for a Legacy Project, I would have thought that using a SourceFileList would be better.  Also, it would explain why the ExcludeFromStyleCop.exe no longer ships as part of StyleCop.  Or am I missing something in this regard?



Jun 18, 2012 at 2:09 PM

Either way is fine.