spacer

ReSharper Web Help

ReSharper provides code quality analysis in C#, VB.NET, XAML, XML, ASP.NET, ASP.NET MVC, JavaScript, HTML, and CSS code, detecting errors, problems, and other code issues before you even compile.

The code analysis is performed by continuously applying over 1300 Code Inspections to your code. By default, ReSharper starts analyzing a code file as soon as you open it in the editor, all the way you edit it, until it is closed. If necessary, you can enable the Solution-Wide Analysis so that all code files are analyzed and you could instantly see whether your whole solution contains any code issues.

spacer  Tip

You can specify files and/or file masks where you do not need to perform code analysis. For more information, see excluding items from code analysis. It may be also useful to exclude auto-generated code files and regions from code analysis.

If needed, you can customize ReSharper's code inspection for your particular needs with the External Annotations.

Not only ReSharper highlights code issues right in Visual Studio code editor, it also adds its own Marker Bar to the right of the editor window, where you can see instantly the status of the file and navigate to code issues. ReSharper also provides commands for navigation between code issues.

For most of the discovered code issues, ReSharper suggests instant corrections: Quick-Fixes, Refactorings, and Code Generation.

ReSharper also provides features that do not detect code issues automatically, but rather allow you to find potential problems yourself by deeper investigation of the code. For more information on these features, see the Code Exploration section.

Another good thing is that you can define you own inspections based on structural search and replace patterns, and specify severity level for them. For more information, see Structural Search and Replace.

ReSharper code analysis is enabled by default.

To switch code analysis on or off
  1. On the main menu, choose ReSharper | Options.
  2. Choose Code Inspection | Settings.
  3. In the Code Inspections: Settings page of ReSharper options, use the Enable code analysis check box to turn code analysis on or off. You can also configure code analysis using other controls in the Settings tab. For details, see Code Inspection Settings.
  4. If necessary, you can select the Analyze errors in whole solution check box to enable the Solution-Wide Analysis.
  5. Optionally, to increase performance of the solution-wide analysis, you can exclude some items.
  6. Click Save to apply the modifications and let ReSharper choose the settings layer or choose a particular settings layer in the Save To drop-down list. To learn more about saving ReSharper settings, see the Save or Save To in ReSharper Optionsspacer article at the JetBrains .NET Tools Blog.

ReSharper allows you to configure the list of files, file masks, and folders that should be excluded from code analysis. Whether the solution-wide analysis is enabled or disabled, no code inspections will be performed within these files.

To exclude items from code analysis
  1. On the main menu, choose ReSharper | Options.
  2. Select Code Inspection | Settings.
  3. In the Code Inspections: Settings page of ReSharper options, click Edit Items to Skip.
  4. In the left part of the Skip Files and Folders dialog box that opens, use Add File and Add Folder buttons to specify files or folders to skip.
  5. In the right part of the dialog box, use Add button to specify masks (e.g. *.cpp) that will exclude all matching files from the analysis.
  6. Click OK.
  7. Click Save to apply the modifications and let ReSharper choose the settings layer or choose a particular settings layer in the Save To drop-down list. To learn more about saving ReSharper settings, see the Save or Save To in ReSharper Optionsspacer article at the JetBrains .NET Tools Blog.

spacer  Tip

You can quickly disable or enable code analysis for the current file. Just press Ctrl+Shift+Alt+8.

You can also configure the list of files, folders, file masks, and regions that contain auto-generated code. Whether the solution-wide analysis is enabled or disabled, code inspections are not performed within auto-generated code. Some file masks and regions that are used by Visual Studio for auto-generated code are included in this list by default, but you can change the default settings, if needed.

To specify files and regions with auto-generated code
  1. On the main menu, choose ReSharper | Options.
  2. Select Code Inspection | Generated Code.
  3. In the Code Inspections: Generated Code page of ReSharper Options, use Add File and Add Folder buttons to specify files or folders to skip.
  4. In the lower left part of the page, use Add button to specify masks (e.g. *.Designer.cs) for auto-generated code files.
  5. In the lower right part of the page, use Add button to specify names of the regions that contain auto-generated code.
  6. Click Save to apply the modifications and let ReSharper choose the settings layer or choose a particular settings layer in the Save To drop-down list. To learn more about saving ReSharper settings, see the Save or Save To in ReSharper Optionsspacer article at the JetBrains .NET Tools Blog.

In this section, you will learn how to:

  • Distinguish between different types of code inspections and their severity levels
  • Find out what exactly is wrong with a highlighted block of code
  • Inspect state of your code using Marker Bar and Status Indicator
  • Extend code analysis to the entire solution
  • Get an overview or all code issues in your whole solution or in a narrower scope.
  • Navigate between highlighted sections of code
  • Eliminate errors using ReSharper's powerful quick-fixes (and you can also glance through various practical examples of quick-fixes)
  • Configure code inspection severity
  • Benefit from external annotations - specifically, for value analysis and custom string formatting methods

See Also

Concepts

Procedures

Reference

External Links

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.