69

I want to tell ReSharper to ignore a few files in my project. Some of them are just too large (they contain canned test data). Some of them are just confusing it (with a mishmash of Silverlight and .NET code).

Is there a way to do this by putting a comment at the top of the file?

However it's done, it needs to be persistent (i.e. can be checked in), and per-file.

I found this, but it doesn't appear to be persisted.

Community
  • 1
  • 1
Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380

3 Answers3

64

This may be a feature in a more recent version than the one available when the question was originally asked.

It is possible to suppress code inspection for a specific block (or file) by using the comments:

// ReSharper disable All 

and

// ReSharper restore All

See here.

Eli Algranti
  • 8,707
  • 2
  • 42
  • 50
62

You can apply this to individual files via a shortcut key.

With the file open try both of these (the actual shortcut depends upon your environment).

  • Ctrl + Shift + Alt + 8
  • Ctrl + 8

You will see that it toggles the processing of this specific file.

The name of this shortcut in the Keyboard dialog is ReSharper_EnableDaemon.

demoncodemonkey
  • 11,730
  • 10
  • 61
  • 103
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
  • 3
    For toggling Code Inspection back on you have to use the same shortcut keys: CTRL + SHIFT + ALT + 8 – Wesley Jan 20 '14 at 13:56
56

In order to skip inspections in some files or folders go to ReSharper | Options | Code Inspection | Settings -> Edit Items to Skip button. Or if your code is generated add it to appropriate list in ReSharper | Options | Generate Code section. You can read more about how it works here.

Pavel Bakshy
  • 7,697
  • 3
  • 37
  • 22
  • 1
    Are those persistent? Which files (if any) do I need to check in? Will they work if another team member checks them out? – Roger Lipscombe Oct 04 '12 at 15:44
  • 2
    If you want to share it with your team members, save changed settings to `solution '...' team-shared` layer. And add `YourSolution.sln.DotSettings` to VCS. Or to do it only for yourself - save to `solution '...' personal` layer. – Pavel Bakshy Oct 04 '12 at 16:18