다음을 통해 공유


Find in Files

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Find in Files allows you to search a specified set of files. The matches Visual Studio finds are listed in the Find Results window in the IDE. How the results appear depends on the options you choose on the Find in Files tab of the Find and Replace dialog box.

Screenshot of the Find and Replace dialog box in Visual Studio 2017, with the Find in Files tab open.

How to display Find in Files

Use the following steps to open the Find and Replace dialog box, or press Ctrl+Shift+F.

  1. On the menu bar, select Edit > Find and Replace.

  2. Choose Find in Files from the fly-out menu.

To cancel a Find operation, press Ctrl+Break.

Note

The Find and Replace tool does not search directories with the Hidden or System attribute.

Find what

To search for a new text string or expression, specify it in the Find what box.

Expression Builder

If you want to use regular expressions in your search string, select the adjacent Expression Builder button that's next to the search box. For more information, see Using regular expressions in Visual Studio.

Note

The Expression Builder button is enabled only if you've selected Use Regular Expressions under Find options.

Look in

The option chosen from the Look in drop-down list determines whether Find in Files searches only in currently active files or in all files stored within certain folders.

Select a search scope from the list or click the Browse (...) button to display the Choose Search Folders dialog box and to enter your own set of directories. You can also type a path directly into the Look in box.

Warning

If you choose the Entire Solution or Current Project options, project and solution files are not searched. If you want to look in project files, select a search folder.

Note

If you use the Look in option to search for a file that you have checked out from source code control, only the version of that file that's has been downloaded to your local machine is found.

Include subfolders

Specifies that subfolders of the Look in folder will be searched.

Find options

You can expand or collapse the Find options section. You can select or clear the following option(s):

Match case

When selected, a Find Results search will be case-sensitive

Match whole word

When selected, the Find Results windows will only return whole word matches.

Use Regular Expressions

If this check box is selected, you can use special notations to define patterns of text to match in the Find what or Replace with text boxes. For a list of these notations, see Using regular expressions in Visual Studio.

Look at these file types

This list indicates the types of files to search through in the Look in directories. If this field is blank, all of the files in the Look in directories will be searched.

Select any item in the list to enter a preconfigured search string that will find files of those particular types.

Result options

You can expand or collapse the Result options section. The following options under List results in can be selected or cleared:

Find results 1 window

When selected, the results of the current search replaces the content of the Find Results 1 window. This window opens automatically to display your search results. To open this window manually, select Other Windows from the View menu and then select Find Results 1.

Find results 2 window

When selected, the results of the current search will replace the content of the Find Results 2 window. This window opens automatically to display your search results. To open this window manually, select Other Windows from the View menu and choose Find Results 2.

Tip

You can toggle between the results windows by pressing Alt+1 or Alt+2.

Find results table

Displays the results of the search in a table format rather than in a text list.

Append results

Appends the results from the search to the previous search results.

Display file names only

Displays a list of files containing search matches rather than displaying the search matches themselves.

Search results

Keep results

You can keep the results from one search while you're performing other searches. This makes it easy to compare results and see them side-by-side.

To keep several search results, select the Keep Results button after each search. Then, when you search for something else, the results are shown in a new tab. You can keep the results of up to five searches. If you've already got five search results showing, the next search will reuse the oldest search result tab.

See also