Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2012 "Find in Files" searches far beyond the solution when "Entire Solution" is specified

While performing Find and Replace operations in Visual Studio 2012; using the Find in Files/Replace in Files dialog window, setting the "Look in" scope to "Entire Solution", and using Regular Expressions on all file types, Visual Studio is busy searching the WHOLE HARD DRIVE! Some of my searches take a very long time and when I look at the Visual Studio Status Bar, it shows the currently searched directory/file is something well outside of the solution folders - sometimes it is even searching the C:\Windows\System32 directory or similarly irrelevant locations.

Has anyone else seen this behavior? More importantly, does anyone have a solution to fix it, so my search and replace operations stick to the solution files and don't waste time searching the other million files on the computer?

like image 901
Zarepheth Avatar asked Sep 21 '13 23:09

Zarepheth


People also ask

How do I search an entire solution in Visual Studio?

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.

How do I search for text in an entire project in Visual Studio?

The new experience is available by searching for “Find in Files” or “Replace in Files” in Visual Studio search (Ctrl+Q by default). You can also get to these commands with Ctrl+Shift+F and Ctrl+Shift+H respectively.

How do I find the path in Visual Studio?

Normally, the path is something like C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ . From Visual Studio, one can use $(VCInstallDir)$ to get this path.


2 Answers

I've not had it searching the whole drive, but I have had it return matches from files outside my project (this in VS 2010). In my case deleting the .suo file appeared to fix this issue.

My suspicion is that the files being searched are files I stepped into during a debugging session (or more accurately stepped out of my code into the calling code). Somehow these files are remembered and included in searches.

This wouldn't explain a full drive search, but could explain my "out of solution" results

like image 134
Jaf Avatar answered Sep 29 '22 11:09

Jaf


I was having a similar problem with Visual Studio 2013 with Update 4 installed - in my case I was getting search results from files that had been in the Miscellaneous Files 'Project', even after removing them from Miscellaneous Files.

Deleting the .suo file from the solution directory solved the problem; however, doing so causes VS to forget which files you had open in the solution (and probably some other things).

like image 33
Dave Kelly Avatar answered Sep 29 '22 13:09

Dave Kelly