Reputation: 3937
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?
Upvotes: 153
Views: 275742
Reputation: 4207
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:
*
Warning: The search could take a while and it may find occurrences in files that shouldn't be edited.
Upvotes: 5
Reputation: 21
I've seen this happen when you move the project from one folder to another. I'm not sure how to fix this "the right way" but if you exit visual studio, delete the .vs folder that corresponds to your solution file, and then re-open the solution, it will recreate the .vs folder correctly for your new project location. You'll lose some customizations (like startup projects), but search will work again as you expect without you having to specify which folder to look in.
I have moved projects with some impunity in the past, so I'm not sure why it has been screwed up recently, but OneDrive is a relatively new part of my strategy, so it might be related.
Upvotes: 0
Reputation: 1
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.
https://devblogs.microsoft.com/visualstudio/new-better-search-in-visual-studio/
Upvotes: 3
Reputation: 321
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
Other, alternative is to open the "Find in Files" window via the "Standard Toolbars" button as highlighted in the below screen-short:
Upvotes: 17
Reputation: 751
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
Upvotes: 42
Reputation: 2454
I think you are talking about ctrl + shift + F, by default it should be on "look in: entire solution" and there you go.
Upvotes: 232
Reputation: 3937
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:
Upvotes: 37