ReSharper 2023.1 Help

Ignore parts of the code

In most solutions, there are parts of the code where you want to disable some or all of ReSharper features. This topic lists all available ways to make ReSharper ignore specific parts of the code.

Ignore projects with frozen or third-party code

Scenario

Improve performance by not indexing and not analyzing projects that contain third-party or frozen code, which is not going to be changed.

How to ignore

List file masks of the projects that should be ignored (for example, Project*.csproj) under Projects to ignore on the Code Inspection | Ignored Code page of ReSharper options (Alt+R, O).

What is disabled

Almost all ReSharper features, for example code analysis, code completion (intellisense), refactorings, code generation.

What is available

After you build projects ignored in this way, symbols from that projects will be recognized by code analysis and code completion (intellisense) in other projects, and they will also be available via navigation and search.

Disable code inspection for parts of the code

Scenario

Minimize unwanted results in design-time code inspection and code inspection in specific scope by ignoring parts of code that you are not going to improve.

How to ignore

  • List specific files and folders or file masks (for example, Test*.cs) under Elements to skip on the Code Inspection | Ignored Code page of ReSharper options (Alt+R, O).

  • To ignore the current file, press Control+Alt+Shift.

  • To ignore a part of a file, add the // ReSharper disable All comment before the ignored part and // ReSharper restore All after it.

What is disabled

All code inspection features as well as structural search and replace.

Disable code inspections with lower severity levels in generated code

Scenario

Ignore generated parts of the code to minimize unwanted results in design-time code inspection and code inspection in specific scope but do not ignore errors and warnings in that parts to make sure that the generated code compiles.

How to ignore

  • List specific files and folders, file masks, or names of regions containing generated code on the Code Inspection | Generated Code page of ReSharper options (Alt+R, O).

  • If you use .editorconfig in your solution, you can also mark generated code using the generated_code property. For example:

    [*generated.cs] generated_code = true

What is disabled

Code inspections with lower severity levels as well as code cleanup.

Exclude files and folders from navigation and search results

Scenario

Remove unwanted items from the results of search and navigation.

How to ignore

List specific files and folders or file masks (for example, Test*.cs) under Elements to skip on the Environment | Search & Navigation page of ReSharper options (Alt+R, O).

What is disabled

All navigation and search commands except Go to Declaration and Go to Type of Symbol, which will be available on usages of symbols from the ignored files.

Exclude types, members, and namespaces from import and completion suggestions

Scenario

You may want some types, members, or namespaces not to be suggested, for example, if you have something similar to a system type in your solution, say MyFramework.MyCollections.List, but you are not actually using it.

How to ignore

To exclude such items from the suggestions, add them to the Exclude from import and completion list on the Code Editing | Type Import page of ReSharper options (Alt+R, O).

The format of the entries is Fully.Qualified.Name, Fully.Qualified.Name.Prefix*, or *Fully.Qualified.Name.Suffix. Generic types are specified as List`1.

What is disabled

The specified items will not appear in import namespace suggestions and in code completion suggestions.

Ignore implicitly used files (C++ and Web languages)

Scenario

Completely ignore files that are implicitly used in your project to improve performance and minimize unwanted results in code analysis and navigation.

Such files would normally be recognised as C++, JavaScript, TypeScript or JSON. For example, generated, minified files, implementations of third-party components that must be included in your project, or scripts that were already gzipped.

How to ignore

List specific files and folders or file masks (for example, *.min.js) under Skipped code on the Code Editing | Third-party code page of ReSharper options (Alt+R, O).

What is disabled

All ReSharper features in these files.

If symbols from these files have direct usages in other places, these usages will not be resolved and highlighted as errors.

Disable code analysis and refactorings in library code (C++ and Web languages)

Scenario

Minimize unwanted results in design-time code inspection and code inspection in specific scope by ignoring parts of code that you use directly but do not maintain, such as jquery.js.

How to ignore

List specific files and folders or file masks (for example, *.ref.js) under Library code on the Code Editing | Third-party code page of ReSharper options (Alt+R, O).

What is disabled

Code inspection to this code and will not try to modify this code with quick-fixes and refactorings.

What is available

Symbols from ignored files will be recognized by code analysis and code completion (intellisense) in other files, and they will also be available via navigation and search.

Last modified: 30 September 2021