Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Visual Studio 2015 Cookbook

You're reading from   Visual Studio 2015 Cookbook Over 50 new and improved recipes to put Visual Studio 2015 to work in your crucial development projects

Arrow left icon
Product type Paperback
Published in Aug 2016
Publisher Packt
ISBN-13 9781785887260
Length 368 pages
Edition 2nd Edition
Arrow right icon
Author (1):
Arrow left icon
Jeff Martin Jeff Martin
Author Profile Icon Jeff Martin
Jeff Martin
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Exploring Visual Studio 2015 2. Getting Started with Universal Windows Platform Apps FREE CHAPTER 3. Web Development 4. .NET Framework Development 5. Debugging Your .NET Application 6. Asynchrony in .NET 7. Unwrapping C++ Development 8. Working with Team Foundation Server 2015 9. Languages 10. Final Polish Index

Navigating in depth

Solution Explorer in VS2015 provides a range of features intended to make navigating and searching within your solution effective without overcomplication. Knowing how to efficiently move among solution files will only help your productivity, so let's take a look at what is available.

Getting ready

Open the same web application solution that we have been using for the other recipes in this chapter, or choose a solution of your own. The concepts here will be of use in any project type.

How to do it...

  1. We'll begin by navigating through our solution. Locate the Global.asax file in the web app solution, and click on the arrow next to it so that its contents are displayed. As you would expect, there is a code-behind file:
    How to do it...
  2. Look at the Global.asax.cs file. You can see that there is a small arrow next to it, just as there was for the Global.asax page. Click on the arrow:
    How to do it...
  3. VS2015 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 MvcApplication class to see the methods inside it. In this case, there is a method called Application_Start(), as shown in the following screenshot:
    How to do it...
  4. Now select the AccountController.cs file from the project, and expand it to see its contents. You will see that there is a class definition (AccountController), as shown in the following screenshot:
    How to do it...
  5. Right-click on the AccountController class, and click on the Base Types option to see what class this is based on:
    How to do it...
  6. The Solution Explorer window will change views to show you the classes that AccountController is derived from, as shown in the following screenshot (with class hierarchy fully expanded). Click on the back button (as marked by the arrow) to return to the standard Solution Explorer view:
    How to do it...
  7. Right-click on the AccountController class, and choose the Is Used By option to see where the interface is currently being used. As with the Base Types or Derived Types options, 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:
    How to do it...
  8. Return to the regular Solution Explorer view by clicking on the home button:
    How to do it...
  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: Ctrl + ; (Ctrl + semicolon).
  10. Enter models in the textbox, and wait a moment for the search results to display. The results should look similar to the following screenshot if you are using the sample project. You can see, not only the filenames that match the search term, but also any matching references, classes, and methods:
    How to do it...

How it works…

The 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 icon enabled for Solution Explorer, as you navigate using Solution Explorer to various classes and methods, you may have noticed that the document preview tab updates and shows 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 the code which is actually inside a method, class, or property. The Preview icon's location in the Solution Explorer window is shown in the following screenshot:

Navigation behavior

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.

lock icon The rest of the chapter is locked
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 $19.99/month. Cancel anytime
Banner background image