Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way to search only a subset of folders in visual studio? I would like to find all instances of

console.log in my code. But, I don't want to search 3rd party *.js files.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

I'm not sure of Visual Studio, but I always keep a copy of Notepad++ handy when searching for something in multiple files. Are your 3rd party javascripts all contained in a vendor folder or something? If you're not doing tier 3 development, move the javascript folder off to your desktop or something, perform the search/replace and then move the folder back.

share|improve this answer

This functionality was requested as a feature addition to Visual Studio and can be seen in this Microsoft Connect issue.

Unfortunately, the issue was closed as "Won't Fix", but a few workarounds exist (albeit with a few more steps required):

Perform the steps listed as the workaround within the Microsoft Connect issue:

Although VS doesn't currently have a context menu item for 'search only in this folder,' it is possible to scope your Find and Replace searches to a given folder. To do this, bring up the Find dialog, choose Find In Files or Replace in Files (not Quick Find or Quick Replace), and click on the '...' button next to the "Look in:" dropdown. This should bring up another dialog that allows you to choose a specific folder or set of folders for your search.

Or do what I do, which is very similar:

  • Right-click on the folder you wish to search in.
  • Select the "Open Folder in File Explorer" option which opens Windows Explorer at the specified location.
  • Copy the full path from Windows Explorer's title bar to your clipboard, then close Windows Explorer.
  • Back in Visual Studio, open up the Find & Replace dialog, and paste in the copied path to the "Look in:" textbox in the dialog.
share|improve this answer

In notepad++ you must open all files. An alternative would be Windows Grep (http://www.wingrep.com/) You can replace in all files in a subset of extension using regular expression.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.