ReSharper Web Help

ReSharper can replace fully qualified names with short names in C# and VB.NET code where possible by importing namespaces.

To shorten qualified references
  1. Choose ReSharper | Options in the main menu.
  2. Open ReSharper | Options | Code Editing | C# | Namespace Imports (for C# settings) or ReSharper | Options | Code Editing | Visual Basic .NET | Namespace Imports (for VB.NET settings).
  3. You can choose to use fully qualified names always or to use short names with namespace imports. In the Reference Qualification section click Insert using directives when necessary or Use fully qualified names. Moreover, you can fine-tune replacing by selecting check boxes.
  4. Open the Code Cleanup options: ReSharper | Options | Code Editing | Code Cleanup.
  5. Create a new profile as described in Creating Custom Profiles. In the Selected profile settings section for the new profile, select Shorten qualified references check box.
  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 JetBrains .NET Tools Blog: Save or Save To in ReSharper Options.
  7. Choose ReSharper | Tools | Cleanup Code in the menu to open the Code Cleanup dialog box for the current file or for a solution node (see Running Code Cleanup for details), and then select the newly created profile in the Available Profiles area.
  8. Click Run to perform Code Cleanup. ReSharper will shorten qualified references in the current file of in the selected solution node.

Tip

You can also shorten qualified references in the specific scope with the Fix in Scope.


This feature is supported in the following languages/technologies:

C# VB.NET HTML ASPX Razor JavaScript TypeScript CSS XML XAML RESX Build Scripts
feature_available feature_available

Tip

The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see the corresponding topics in the ReSharper by Language section.