Learn about the enhancements in the Find All References tool window. It provides a colorized list of existing type references and provides grouping, filtering, sorting, searching, within reference results.
- [Instructor] You're working in your code, and you're looking at this book class, and you want to know how many parts of your code base reference this class, which at this time is only in the Enterprise edition. If you are in the class itself, like I'm in the book class right now, and I'm in a version of Visual Studio that supports code blends, you can see that information here. You can see there's six references. But if I'm in a consumer, let's say I'm over here in this XMAL file.
I'll go to the code behind for the XMAL file, and I'm seeing the book referenced here as a variable type, there's no way to get a code lens for that. There's a way to look up the references anywhere by right clicking and choosing find all references, or choosing shift F12. That opens this window. It's called the find references window, and you'll see that it says book references, now. It's telling me that's what I last searched for, that's the type that I searched for. This window has been in Visual Studio for several versions.
There are a lot of improvements, however. One of the improvements is that you get color coding of your lines of text that you see in here. So they match what you would see if you were looking at this code in the C# editor. The find references also works in C++, and it works in Visual Basic, so they get color syntax there, too. Across the top of the tool window are a number of other features. Three that exist in Visual Studio 2015 are here. Copy, go to, previous, and go to next.
Everything else in this toolbar is new. So what do we got here. Over on the left side we've got a scope box. Right now I'm searching the entire solution. I can limit that to just my open documents, or I can limit it to the current project, or the current document. I can choose to group the data. Right now I'm grouped by definition. I can choose to group it by project, and then by definition, so I see that inside my WPF application I have a reference, inside by MVC web application I have a reference, and inside my publisher library I've got some references to that type.
There's some other ways of grouping, including one that shows you the path on your hard drive. When you're looking at this list in a real project, you might have dozens or maybe even hundreds of references. In that case, you might want to filter down. So you come over here and choose search, find all references. I'll look for the get random book. Also, you can use this reference window to navigate through your code. So when you click on one of these items, you'll see that up here in the code editor, it's moving to that file.
It's showing me the text. In the previous version of Visual Studio, you moved around by using these buttons. Now you can go directly there. Now let's do another search. This time I'll look for the author class. So I'll go over to the author class, and I'll right click. Find all references. And you'll see that it shows up, but I lost my previous list. You can imagine some situations when you're coding and you want to understand multiple references, so you don't want to lose your previous results.
So what you do is you click on keep results. So that will keep this author results. Now when I go back to the book class and find all references, you'll see that I've got two tabs across the bottom now. This shows all my book references, this shows all my author references. Let's review what we've seen. This enhanced reference window now allows you to have color coding in your text. It allows you to have grouping, filtering, sorting, and searching within the reference results.
- Installing Visual Studio 2017
- Using debugging features
- Reviewing document navigation enhancements
- Examining IntelliSense Improvements
- Using XAML tools
- Reviewing the tooling added to support Docker containers
- Debugging without the hosting process
- Using the Visual Studio 2017 Installer