Visual Studio 2012 New Features: Solution Explorer

I love the title of this one because I’m sure someone will read this and wonder why I think Solution Explorer is a “new” feature.  I mean, haven’t we had this sucker for a billion years?  Aren’t there cave drawings in France about this feature?  So why is it “new”?  Let me show you!

 

Search Solution Explorer (CTRL + ;)

First and foremost, you can now search Solution Explorer!  I’ve been wanting a feature like this since before Solution Explorer was even invented back in my VB 3 days (about 19 years ago).  Here is what things looked like back then:

image

 

And from then until Visual Studio 2010 we STILL couldn’t search items:

image

 

But now you can!  Just type in any search term into the Search Solution Explorer textbox:

image

 

And it will find anything that contains the search term in it:

image

 

You can filter the search to choose how broad the search goes by clicking on the drop down arrow to the far right of the Search Solution Explorer textbox:

(NOTE: searching within file contents doesn’t mean what you think it means.  See the section “More Than Physical” for information)

image

 

One other cool feature is you can have Solution Explorer only show you the currently open files by clicking the drop down button just to the right of the Home button:

image

 

 

More Than Physical

In the past, Solution Explorer was relegated to only showing physical elements or those things that help contain / organize those elements (i.e. solution folders).  That’s out the window, too.  Now the experience doesn’t stop at the physical level but extends to logical elements as well:

image

 

Which makes searching even more awesome:

image

 

If you are using the Preview Tab then clicking on any item in Solution Explorer will go to the file and highlight code if applicable BUT you can’t double click the logical item to open the file for some reason and instead have to double click the filename to open it.

 

 

Navigation is much improved as well. 

 

Browser-Like Movement

After a doing a search, like the one shown above, you can click the Home button:

image

 

And Solution Explorer will go back to “normal”:

image

 

Clicking the Back button:

image

 

Takes me back to the search I just did:

image

 

Here is the weird part:  If I reuse the search box and type another search right away it doesn’t remember the previous search I did and I can’t go back; BUT if I click Home between searches then it remembers all my old searches.  I’ve tested this up to 12 entries and it works fine as long as you remember to click Home between searches.

 

Sync with Active Document

Occasionally you may be looking at a file but Solution Explorer isn’t on that file.  When this happens a button appears that allows you to sync Solution Explorer with the document you are currently in so you can see where it is in the project structure.

image

 

Right Click Experience

The right click experience is, to say the least, incredible!  Depending on what you select the context menu changes appropriately.  So if I right click a code file this is what I get:

image

 

But if I right click a class this is what I get:

image

 

And this is the context menu for a method:

image

 

Each option changes the view in Solution Explorer to better examine relationships.  The bottom line:  make sure to check out your context menus to change the elements you are viewing in Solution Explorer.

 

 

New Solution Explorer View

There used to be a button for creating a new instance of Solution Explorer which was excellent for multi-monitor viewing of code:

image

 

The button is gone now (which is a mistake in my opinion) and you can no longer get an entire copy of Solution Explorer in a new window BUT you can get a copy of any project or file in a new Solution Explorer window which is what I have done in the example above.  Just right click any project/file and choose New Solution Explorer View:

image

 

 

Team Foundation Server

If you are using TFS then you can filter Solution Explorer to show you files with Pending Changes:

image

 

And there you have it!  As you can see there are quite a few changes in the new, improved Solution Explorer so go explore!