Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to actually search all files in Visual Studio

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?

like image 239
Mike Godin Avatar asked Aug 14 '14 14:08

Mike Godin


People also ask

How do I search an entire project in Visual Studio?

Find in Files (Ctrl+Shift+F): A more robust option, Find in Files is better for searching entire projects or solutions. Unlike Quick Find, Find in Files can list search results in the Find Results window and has additional options to specify which file extensions to search.

How do I search for a string in all files in Visual Studio?

In Visual Studio 2022 and later, you can set Visual Studio to always keep results. Go to Tools > Options > General > Find and Replace, and select the checkbox for Keep search results by default.

How do you find the whole solution?

Ctrl + Shift + F – Find in Solution Sometimes you want to search across your entire solution. You can double-click each item in the “Find Results” window to navigate to that instance of the search term you searched for.


2 Answers

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

like image 167
n4feng Avatar answered Sep 18 '22 21:09

n4feng


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".
like image 22
Mike Godin Avatar answered Sep 20 '22 21:09

Mike Godin