All docs
V20.1
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Import Missing Namespaces

Purpose

This refactoring locates types with missing namespace references and adds "using" directives. It relies on Visual Studio to retrieve the namespace list.

NOTE

This refactoring is available in Visual Studio 2019.

Availability

This refactoring works inside a selected code block with missing namespaces or for active code elements.

How to Use

  1. Select a code block with missing namespaces or place the caret in an active code element.

  2. Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu.

  3. Select Import Missing Namespaces from the menu.

After execution, this Refactoring adds the using directives for each type with a missing namespace reference.