When you search for a text in Visual Studio, by default it lists the matched code block along with the file name in the search result. But, some time just listing the file name is enough to focus on where the text is available.

 

Visual Studio provides an option to drill down the search result and to keep you focused on what you wanted to view. In this part of my Visual Studio Productivity Tips series, let's learn how to do that.


Visual Studio Productivity Tips:


 

Visual Studio Productivity Tips: Limit search results to filename only

 

When you search for a term in the Find and Replace dialog window, it displays the result with matched file name along with the matched code line. Its the default view of the Find Results dialog. As shown in the below screenshot, it contains the file name (left) and the matched line (right) in the result window:

 

When you search for a term in the Find and Replace dialog window, it displays the result with matched file name along with the matched code line

 

When you would like to focus only to the file names, where the term is present, invoke the Find and Replace dialog and select the Display file names only under the Result options, before hitting "Find" as shown below:

 

Visual Studio 'Find and Replace' dialog window

 

This will result a list of file names where the search term is present. Thus, narrows down the search and helps you to focus on what you want to view. Here's a screenshot that you would like to refer:

 

This results a list of file names where the search term is present

 

I hope that this quick tip will help you next time when you hit search in your Visual Studio editor. Don't forget to share this trick with your friends and colleague.

 

 


Kunal Chowdhury

About the Author

Solution Architect & Former Microsoft MVP

Kunal Chowdhury is an enterprise solution architect and former multi-year Microsoft MVP. He is the author of three technical books: Windows Presentation Foundation Development Cookbook, Mastering Visual Studio 2017, and the Mastering Visual Studio 2019.

He publishes technical and non-technical articles on .