views:

1263

answers:

2

We’ve just been working on introducing StyleCop to our team and are using the StyleCop ReSharper plugin from Code Plex. Problem is, every single file in the project appears to be getting analysed and we can’t find a way to exclude particular files. This includes files such as the designer.cs file from the DBML or third party components included in the project. What this means is your site wide code analysis in ReSharper always shows up errors and you can never get it to go “green”.

There’s always the ExcludeFromStyleCop tag which you can put in the .csproj but this is only used by MSBuild. Right clicking the file in the ReSharper error window and telling it to “Ignore Errors” also doesn’t seem to work; the window just reloads and the same file gets analysed again.

Anyone got any ideas on this?

+3  A: 

"Are you sure you have have unchecked the StyleCop settings option that specifies stylecop should check designer files? (StyleCop Options > Rules > Detailed Settings > Analyze Designer Files)?"

http://stylecopforresharper.codeplex.com/Thread/View.aspx?ThreadId=47346

Stuart Dunkeld
Thanks Stuart, that partly solved the problem in that it ignores the LINQ generated file. Still need a way of ignoring files from 3rd party tools though (i.e. spell check tool which launches in a popup window).
Troy Hunt
+2  A: 

You can completely disable ReSharper for a particular file by pressing CTRL + 8. You'll see the little 'eye' in the top right of the code window (at the top of the gutter) go grey, indicating it's disabled.

Press the keystroke again to re-enable it.

Drew Noakes

related questions