Replace in Files
Replace in Files allows you to search the code of a specified set of files for a string or expression, and change some or all of the matches found. The matches found and actions taken are listed in the Find Results window selected in Result options.
Note
|
|---|
|
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings. |
You can use any of the following methods to display Replace in Files in the Find and Replace window.
To display Replace in Files
-
On the Edit menu, expand Find and Replace.
-
Choose Replace in Files.
— or —
If the Find and Replace window is already open, on the toolbar, choose Replace in Files.
To search for a new text string or expression, specify it in the box. To search for any of the 20 strings that you searched for most recently, open the list, and choose the string for which you want to search. Choose the adjacent Expression Builder button if you want to use one or more regular expressions in your search string. For more information, see Using Regular Expressions in Visual Studio.
To replace instances of the string in the Find what box with another string, enter the replacement string in the Replace With box. To delete instances of the string in the Find what box, leave this field blank. Open the list to display the 20 strings for which you searched most recently. Choose the adjacent Expression Builder button if you want to use one or more regular expressions in your replacement string. For more information, see Using Regular Expressions in Visual Studio.
The option chosen from the Look in drop-down list determines whether Replace in Files searches only in currently active files or searches all files stored within certain folders. Select a search scope from the list, type a folder path, or click the Browse (...) button to display the Choose Search Folders dialog box and choose a set of folders to search. You can also type a path directly into the Look in box.
Note
|
|---|
|
If the Look in option selected causes you to search a file that you have checked out from source code control, only the version of that file which has been downloaded to your local machine is searched. |
Note