Lately I’ve been speaking at local user groups about many of the exciting new features in Visual Studio 2012. Since there is so much to know and learn about VS 2012, I decided to create a collection of blog posts with many of the tips. This collection of posts will include features that are new to VS 2012 as well as some existing features as well. To view all of the VS 2012 tips posted so far, click here.


How to Search in Solution Explorer

imageThe solution explorer in Visual Studio 2012 has a ton of new features. In this post, I’ll show one of my favorites: Search. It’s worth noting that there are a bunch of other new search features throughout VS 2012 as well. In the screen shot, I’ve circled the search area in blue. If you think that another search box in VS isn’t needed, just wait. The solution explorer search is different than the regular search that we are used to in Visual Studio. The normal search is a “text search”. Solution Explorer search is based on your file names, classes, and methods, but not local variables or plain text. I’ll show an example.












Note that in the screenshot of the code, I’ve underlined all the usages of word “Home” in several places: a comment, the class name, a method, a property, a class level variable (field) and a method variable.










imageHere you can see that I’ve searched for “Home” in the solution explorer. The results are shown conveniently right within the Solution Explorer (basically a filter). And in this case, the yellow highlighting was not added by me, VS highlights the text that matches the search. The search found the file, class, field, method, and property. It also found the folder named Home and the unit test too. But do you notice what is NOT shown? The comment and the string literal are not shown, neither is the method level local variable. This kind of search can be very helpful when you need to find things in your code but you don’t want to get caught up in all of the comments or commented out code.






imageLastly, I want to point out that you can even combine search with the other built in filters to Solution Explorer such as the Pending Changes Filter and the Open Files Filter. If you want to know more about those filter features, please see this post: Visual Studio 2012 Tip: Solution Explorer Filters





I hope you find this tip helpful. To see more VS 2012 Tips, just click here.

Leave a reply


<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>