Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Visual Studio 2013 Cookbook

You're reading from   Visual Studio 2013 Cookbook Understanding the latest features of Visual Studio can speed up and streamline your projects. And there's no better learning tool than this collection of focused recipes that gives you the fast, hands-on experience you need.

Arrow left icon
Product type Paperback
Published in Mar 2014
Publisher Packt
ISBN-13 9781782171966
Length 332 pages
Edition Edition
Languages
Arrow right icon
Toc

Table of Contents (17) Chapters Close

Visual Studio 2013 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1. Discovering Visual Studio 2013 FREE CHAPTER 2. Getting Started with Windows Store Applications 3. Web Development – ASP.NET, HTML5, CSS, and JavaScript 4. .NET Framework 4.5.1 Development 5. Debugging Your .NET Application 6. Asynchrony in .NET 7. Unwrapping C++ Development 8. Working with Team Foundation Server 2013 9. Languages Visual Studio Medley Index

Navigating in depth


The Solution Explorer window that we were accustomed to in Visual Studio 2010 was good for being able to understand how files were organized into the various projects of a solution, but it didn't do much more than that. With Visual Studio 2013, Microsoft has revisited Solution Explorer and given it an overhaul. It still contains all of the functionalities you know from the old Solution Explorer, and it adds to that a range of new features intended to make navigating and searching within your solution a more powerful yet simpler experience.

Getting ready

Open the same VS2010_Web solution that we have been using for the other recipes in this chapter or choose a solution of your own.

How to do it...

  1. We'll begin by navigating through our solution. Locate the Default.aspx page in the VS2010_Web project and click on the arrow next to it so that its contents are displayed. As you would expect, there is a code-behind file and a designer file:

  2. Look at the Default.aspx.cs file. You can see that there is a small arrow next to it just as there was for the Default.aspx page. Click on the arrow:

  3. Visual Studio 2013 expands the file to show its contents, and in the case of a code-behind file, these contents are the class definitions it contains. Classes have methods and properties in them, so click on the arrow next to the _Default class to see the methods inside it. Since the VS2010_Web project is just a shell, there is only an empty Page_Load() method, as shown in the following screenshot:

  4. Now select the IService1.cs file from the VS2010_Web.Services project and expand it to see its contents. You will see that there is both an interface definition in this file (IService1) and a class definition (CompositeType), as shown in the following screenshot:

  5. Right-click on the IService1 interface and click on the Derived Types option to see what classes implement this interface:

  6. The Solution Explorer window will change views to show you the types that either implement this interface or inherit from it, as shown in the following screenshot. Click on the back button (showing the blue background) to return to the standard Solution Explorer view:

  7. Right-click on the IService1 interface and choose the Is Used By option to see where the interface is currently being used. As with the Derived Types option, you will see Solution Explorer change its context to only show the interface and where that interface is used in the solution, including line and column numbers:

  8. Return to the regular Solution Explorer view by clicking on the home button, shown in the following screenshot:

  9. At this point, you know how to navigate using Solution Explorer, and you have already used the existing Navigate To feature in the Finding Visual Studio commands recipe while opening a file. With the enhancements to Solution Explorer, you can locate files in much the same way as with the Navigate To command, albeit with a slightly different user experience. Click on the Search Solution Explorer textbox at the top of the Solution Explorer window, or use the default shortcut key of Ctrl + ; (Ctrl + semicolon).

  10. Enter serv in the textbox and wait a moment for the search results to display. The results should look similar to the following screenshot. You can not only see the filenames that match the search term but also any matching references, classes, and methods:

How it works...

The Navigate To feature from Visual Studio 2010 was a fantastic addition to Visual Studio. It had problems in large projects with many search matches as the location of a match was embedded in the result itself, making it hard to locate the specific match you were after. The new Solution Explorer search tool provides similar results to the Navigate To feature, but having the location of a match represented in the tree view makes it very easy to quickly identify the specific match you are interested in.

There's more...

It's worth mentioning a few other things about searching within your solution.

Navigation behavior

Assuming you have the Preview Tab enabled for Solution Explorer, as you navigate using Solution Explorer to various classes and methods, you may have noticed that the document preview tab was updating and showing exactly where the selected class, method, or property was declared. This makes it easy to see what the code is doing without the need to specifically open the file or scroll through a source file to see what code is actually inside a method, class, or property.

CSS, HTML, and JavaScript files

Even though it's possible to extract the structure from CSS, HTML, and JavaScript files, Solution Explorer doesn't show the internal structure of these files. You can navigate to the source file, but not to any of its contents.

You have been reading a chapter from
Visual Studio 2013 Cookbook
Published in: Mar 2014
Publisher: Packt
ISBN-13: 9781782171966
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime