Visual Studio: How to include missing namespaces

Some of my readers have problem with detecting correct namespaces to include in code samples. Here is how to get references in place using Visual Studio IDE. You can let Visual Studio to solve references to types that have no namespaces for them included in code file. Move cursor to unreferenced type, right click on it with mouse, select Resolve and then select correct type.

Click on image below to see how I resolve Math type.

Visual Studio: Resolve reference

Those of you who have Resharper can use more powerful type resolving, of course.

Gunnar Peipman

Gunnar Peipman is ASP.NET, Azure and SharePoint fan, Estonian Microsoft user group leader, blogger, conference speaker, teacher, and tech maniac. Since 2008 he is Microsoft MVP specialized on ASP.NET.

    2 thoughts on “Visual Studio: How to include missing namespaces

    • November 2, 2010 at 3:27 am
      Permalink

      In C# you can put the cursor anywhere in the word and hit Ctrl+. too.

    • November 8, 2010 at 9:02 am
      Permalink

      you also can put the cursor anywhere in the word, press shift+alt+F10

    Leave a Reply

    Your email address will not be published. Required fields are marked *