140

I am using Visual Studio. Say for instance I have a static public method named FooBar() in class Utils. Let's also say that I use this method in a lot of .aspx files. Let's say I change the method signature of FooBar() to FooBar(string), and subsequently I'd like to find all the instances of Utils.FooBar so I can update them.

Now let's say I go to the Solution Explorer search box, select "Search within file contents", and type "Utils". Despite the fact that I make Utils.* method calls everywhere, the only thing that shows up is the Utils.cs file. If I keep typing "Utils.FooBar", nothing shows up.

Right now, I am launching a cygwin window and using grep since normal windows search is pretty useless too. But it seems like there there must be an actual way of searching within all files in Visual Studio. Am I missing something?

Mike Godin
  • 3,727
  • 3
  • 27
  • 29

6 Answers6

210

I think you are talking about ctrl + shift + F, by default it should be on "look in: entire solution" and there you go.

Jeff Puckett
  • 37,464
  • 17
  • 118
  • 167
n4feng
  • 2,226
  • 3
  • 11
  • 17
38

Press Ctrl+,

Then you will see a docked window under name of "Go to all"

This a picture of the "Go to all" in my IDE

Picture

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Ahmed Ibrahim
  • 681
  • 8
  • 12
37

So the answer seems to be to NOT use the Solution Explorer search box.

Rather, open any file in the solution, then use the control-f search pop-up to search all files by:

  1. selecting "Find All" from the "--> Find Next / <-- Find Previous" selector
  2. selecting "Current Project" or "Entire Solution" from the selector that normally says just "Current Document".
Mike Godin
  • 3,727
  • 3
  • 27
  • 29
  • 4
    the issue is that sometimes i dont have the option "Entire Solution" but i dont know why yet. The `ctrl + shift + f` approach works. – Muflix Mar 13 '17 at 12:33
16

One can access the "Find in Files" window via the drop-down menu selection and search all files in the Entire Solution: Edit > Find and Replace > Find in Files

enter image description here

Other, alternative is to open the "Find in Files" window via the "Standard Toolbars" button as highlighted in the below screen-short:

enter image description here

Nash
  • 311
  • 3
  • 7
3

Preface: As others have said, ctrl+shift+F is the tool, but I am so often frustrated by the fact that the default options don't find everything!

Answer: If you want to search every file then, from the "Find in Files" tab:

  1. Click the ellipses to the right of "Look in" then choose the folder containing your Solution.
  2. Set "File types" to *
  3. Click "Find All" and finally find what you were looking for.

Warning: The search could take a while and it may find occurrences in files that shouldn't be edited.

Search all files in the Solution.

Design.Garden
  • 3,607
  • 25
  • 21
  • Wish I'd seen this before having to rediscover for myself! The default search filetype in VS 2019 includes this pattern: **`*\.*`** - which doesn't really match all files and should be replaced by **`*`** or **`*.*`** – user6096790 Jun 21 '23 at 23:54
0

Visual Studio 2022 has come up with a very powerful search feature. I have used this feature in VS 2022 17.5.

In my case I just double-clicked the method name and pressed ctrl + t. and you see the magic.

enter image description here

https://devblogs.microsoft.com/visualstudio/new-better-search-in-visual-studio/

Vivek Nuna
  • 25,472
  • 25
  • 109
  • 197