Configuring Visual Studio to manage using directives automatically

 
 
  • Gérald Barré

With recent versions of Visual Studio, you don't need to manage using directives manually. Indeed, VS can add/remove them automatically. So, showing them is just a waste of space in the editor. Hopefully, Visual Studio has new options to hide them by default!

Let's see how to configure Visual Studio to handle using directives automatically.

#Collapsing using directives automatically

When you open a file, VS will automatically collapse all using directives:

#Adding using directives

Visual Studio can show types from unimported namespaces in Intellisense. When selecting an item, Visual Studio automatically adds the using directive if needed. Also, you can add using directives when pasting code.

#Cleaning up unused usings

If you want to clean up unused usings, you can configure Visual Studio to run Code Cleanup on saving changes.

Do you have a question or a suggestion about this post? Contact me!

Follow me:
Enjoy this blog?Buy Me A Coffee💖 Sponsor on GitHub