Zarepheth
Zarepheth

Reputation: 2603

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?

Upvotes: 18

Views: 2358

Answers (4)

Federico Schiocchet
Federico Schiocchet

Reputation: 177

For me the solution was to move the file .sln into the solution directory.

Upvotes: 0

Brien Foss
Brien Foss

Reputation: 3367

Still occurring in Visual Studio Enterprise 2017, Version 15.8.6.

Deleting the .suo file (found in .\.vs\YourSolutionName\v15\) and rebuilding the solution fixed the issue.

I suspect it's known directory/targeted directory to search was being cached there because the Find Results would show up very quickly. Indicative of it not searching the "whole hard drive", or even my whole mapped workspace "Local Folder". Typically if I am performing a search on even a more parent branch in source control, it will take close to a minute.

Upvotes: 6

Dave Kelly
Dave Kelly

Reputation: 71

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).

Upvotes: 6

Jaf
Jaf

Reputation: 121

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

Upvotes: 12

Related Questions