serhio
serhio

Reputation: 28586

Visual Studio "Find in Files" does not work

Visual Studio (2010, Ultimate) finds nothing when I do Find in Files (Ctrl+Shift+F) in the Entire Solution. However, it finds 2 occurrences when searching Current Document or Current Project.

I see that the "Total files searched" in the output window is a random number, and does not correspond to the number of files in my solution (is much smaller).

I already did devenv /resetsettings but this didn't help.

Example of output of 2 consecutive searches in "all solution":

Find all "zoom -", Subfolders, Keep modified files open, Find Results 1, "Entire Solution", "*.vb"
Matching lines: 0 Matching files: 0 Total files searched: 24
Find was stopped in progress.

Find all "zoom -", Subfolders, Keep modified files open, Find Results 1, "Entire Solution", "*.vb" Matching lines: 0 Matching files: 0 Total files searched: 32
Find was stopped in progress.

I don't know why it says "Find was stopped", because I wait the end of search (don't press any buttons).

Upvotes: 60

Views: 44765

Answers (19)

dgmz
dgmz

Reputation: 413

A quick fix for it is to hit Ctrl + Shift + F once and hit Ok once, then quickly hit Ctrl + Shift + F once again and hit the Stop Find button before the initial search is complete.

After this, try again to Search normally should prompt the correct output and display all occurrences in the Entire Solution.

Upvotes: 0

AH.
AH.

Reputation: 3101

Maybe a quite hard way to fix it, but I deleted all files in AppData\Local\Microsoft\VisualStudio and then Ctrl+Shift+F worked again.

Use %localappdata% in File Explorer and select Microsoft\VisualStudio and then delete the files in that folder.

Upvotes: 0

makdu
makdu

Reputation: 946

Following worked for me:

Visual Studio → WindowsReset Window Panel.

The resizing of the visual studio made it to hide the option.

Upvotes: 9

Brian Cao
Brian Cao

Reputation: 31

Visual Studio 2022. Tried all of above and none worked for me. What did work for me was clicking "Use Regular Expressions" even though I wasn't using regular expressions. Once I did that, it started working.

Upvotes: 1

JimmyV
JimmyV

Reputation: 540

I had this problem in Visual Studio 2019 Professional. The above solutions did not work for me. I was able to solve this by:

  1. Press CTRL+F to open the find tool window

  2. Expand the drop down of your search history Find drop down

  3. At the bottom of the drop down you should see Search Options and under that Find in Files..Find and Replace options

    Somehow, my options got saved as Current Directory and the bin, obj, and packages sub directories.

  4. Change the "Look in" item to any other option and it started to behave as expected.

Upvotes: 5

KeyC0de
KeyC0de

Reputation: 5277

Make sure you are searching the Entire Solution and that you tick both of the options Include external files and Include miscellaneous files.

Upvotes: 0

Mitko Keckaroski
Mitko Keckaroski

Reputation: 1040

"Include miscellaneous files" works for me.

enter image description here

Upvotes: 0

Ali Karaca
Ali Karaca

Reputation: 3871

Visual Studio 2022 Community Edition v17.2.5

i uninstalled pro version and installed community, only solution worked for me is:

File Types : *.*

Upvotes: 2

cheny
cheny

Reputation: 2735

I met this problem when I was debuging 2 solutions, one of which was csharp and another was cpp. When I did the search in the cpp solution, the "file types" were still ".cs;.cshtml...". Switching to "*.cpp;..." fixed the problem.

Because I usually work in csharp, and it did take me quite a time to realized it.

Upvotes: 0

For me I just Change file types!!!

my version of visual studio is 16.11.9

enter image description here

Upvotes: 0

Miko
Miko

Reputation: 23

I just fixed mine by deleting and re-creating the solution/project files. Nothing else worked (ie: no button presses, window reset. restarting VS and the PC)

A symptom of the issue I had was that it was only not finding stuff from certain projects, but was able to find the same text if it was referenced in other projects (ie: as if Find in Files was disabled for just one project/directory tree).

So if you have the same symptom and nothing else works then try this solution and let me know if that helps.

Upvotes: 0

Tomasz Kot
Tomasz Kot

Reputation: 293

It's also not working for me on VS 2019 (16.6) I use a workaround by switching to "Use previous Find in Files": Tools->Options->Environment->Preview Features

Upvotes: 8

Roman Pfneudl
Roman Pfneudl

Reputation: 717

Like many other problems where VS simply stops to work properly, deleting the solutions .vs (located in the solution directory) seems to be a 'valid option'.

CAUTION: this will cause you to loose:

  • breakpoints
  • tabs / open documents
  • currently set build configuration
  • other non-vital information

... along with a lot of wrongly cached information that VS successfully managed to pile up leading to wrong find results.

I do this regularily when i encounter extreme lags even in debug-startups.

Upvotes: 13

BrentC
BrentC

Reputation: 1

It's silly, but what fixed it for me was prefacing the file extensions with an asterisk under Look at these File types e.g.: *.js; *.aspx instead of just .js; .aspx Maybe try *.* if you're having this issue.

Upvotes: 0

sehe
sehe

Reputation: 393709

I think I recognize this wellknown, longstanding bug:

The workaround mentioned there worked for me when I had this problem

I found a tip to try pressing Ctrl + ScrollLock to fix it, and it worked.

I think most people report success with the (Ctrl-)Break key, but some say (Ctrl-)ScrollLock worked instead

Upvotes: 62

JKJ
JKJ

Reputation: 575

This is obviously a way late answer but I did get here while looking for a solution to a somewhat similar issue and I'd like to share the fix which eventually worked:

Make sure you clear the "Look at these file types:" box from whitespaces which will prevent the search from running properly.

Upvotes: 18

Claus Appel
Claus Appel

Reputation: 429

I fixed this by uninstalling and reinstalling Visual Studio (2017 Professional in my case).

Upvotes: 0

def
def

Reputation: 561

For me it started to work once I switched from "Find results 1 window" to "Find results 2 window" found in "Find and Replace" results option.

Upvotes: 0

Disillusioned
Disillusioned

Reputation: 14842

I experienced a similar but not identical symptoms in VS 2017.

In my case Find in Files searched 109 files; but that was only project files in the solution and dependencies. It turns out there is an option to "see more results", but it obscurely violates conventions making it less obvious. And to make it worse, I found I had to double-click (not just "click").

Observe the very last line after the summary. When I double-click that line, only then do I get expected behaviour!

Find in Files

Upvotes: 2

Related Questions