Quick Tip - Locating Namespaces in Visual Studio

Published Dec 31, 2014 (10 years ago)
Danger icon
The last modifications of this post were around 10 years ago, some information may be outdated!

When I’m using Visual Studio 2013 Community (for free too!) while working on my pet project, I’ve come to realize how dependent I’ve become upon Resharper for a lot of simple programming needs. While attempting to build some code and compile it, it turns out I was missing a namespace reference that I didn’t immediately know where to find it. After a little experimentation, here’s a trick I found that helps about 90% of the time.

Here are the quick pictures/steps.

1. Build and see your problems…

findnamespace_1

Yep, I can’t compile, a couple namespaces are missing.

2. Move the cursor to the object and press F12

findnamespace_2

The F12 command is the “Go to Definition” command used to easily navigate to a function or object definition, giving you the details on its structure and methods. Click the cursor on the type of object you need the details for and press F12. The “symbol results” window will pop up some options for you.

3. Add using statement for the namespace you need.

findnamespace_3

Once you know the namespace you need add the appropriate using statement to the top of the page. In my case, I added two or three and bingo I have properly compiling code!

If you know any other tricks, pass them along!