Skip to main content

Import Missing Namespaces


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


This refactoring is available in Visual Studio 2019.


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. Press 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.