Is there a way to disable ReSharper for a specific file?

Resharper

Resharper Problem Overview


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.

Resharper Solutions


Solution 1 - Resharper

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.

Solution 2 - Resharper

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.

Solution 3 - Resharper

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRoger LipscombeView Question on Stackoverflow
Solution 1 - ResharperEli AlgrantiView Answer on Stackoverflow
Solution 2 - ResharperDrew NoakesView Answer on Stackoverflow
Solution 3 - ResharperPavel BakshyView Answer on Stackoverflow