Aheho
Aheho

Reputation: 12821

Visual studio 2008 - Find in files : lists everything twice

In VS2008, I have a web-site project. When I use find in files and search for a string, the find results window will list every occurence twice.

What could be causing this?

[EDIT]

Below is the screen capture from VS. I was searching for the work CommissionBucketProductID within my website project. Notice that each line is returned twice.

Screen Capture

[EDIT2]

In response to your questions. I am only searching within the project, not the whole solution. I currently don't have these files under VSS, although they were in the past.

Upvotes: 8

Views: 5898

Answers (10)

Marc Greiner
Marc Greiner

Reputation: 1

In the "Look in" field of the "Find and Replace" dialog box, make sure that the folder to be scanned is listed only once. You can list multiple folders, separated by commas. If a folder is listed twice, you will get twice the result!

Upvotes: 0

ykay
ykay

Reputation: 1973

Here's your answer:

Find in Files searches same files twice

This seems to happen for files that are shared between multiple projects in the same solution, causing them to get searched twice. Since the problem exists in VS2010, it must have been inherited from VS2008, which probably means you're pretty much out of luck (unless you work around it, such as by separating the projects into multiple solutions).

But in the meantime, it sounds like it's not high enough on Microsoft's priority list to get this fixed.

Upvotes: 2

ThinkAgain
ThinkAgain

Reputation: 13

This is an old thread, but this still happens.

As new info, I just found that the solution contains a Setup project, which naturally references some of the projects, besides the solution itself.

In that case, when searching the Entire Solution there are two routes to some files.

Upvotes: 0

kirasglimmer
kirasglimmer

Reputation: 114

Make sure your web project does NOT have any virtual directories that point back to other areas of the site.

Verify that VS2008 shows the same virtual directories (if any) that IIS has.

If you have mis-pointed or mis-configured Virtual directories, it will cause a HUGE performance hit, search result replication, etc.

Upvotes: 0

BugFreeSoftware
BugFreeSoftware

Reputation: 101

I had a similar problem. VS would turn up find solution results from files I had loaded in the IDE just to view them and then closed again. So it would search through files that weren't even in the solution.

I scanned all files in the solution, but there was no reference to these phantom files stored anywhere. Finally I decided to scan the registry and found that they were stored in the MRU list. After deleting the MRU list entries, the expected behavior was restored.

Upvotes: 0

Henry
Henry

Reputation:

I had the same issue which was annoying. I just fixed it. What I've done is to change "Entire solution" to "current project" in "Look in" field when doing search. Then I noticed the result would not be doubled. After I switched back to "entire solution" the problem was gone.

Upvotes: 9

Jim Buck
Jim Buck

Reputation: 20724

I use VS2003, but I get this exact result when I have the same source file in multiple projects. Are you sure you aren't searching more than one project?

Upvotes: 3

Mark
Mark

Reputation: 14950

Try closing VS2008, renaming the file (USPostalApplciation.aspx and the code behind file too), then re-opening VS2008, refresh everything you can think of (project, solution, etc...) then try doing the search again.

Upvotes: 0

LeopardSkinPillBoxHat
LeopardSkinPillBoxHat

Reputation: 29441

Do you have any symbolic links to a directory/file within the same search scope? This could cause the file to be listed twice: once for the primary file, and once for the link to the file. Although from memory it should show the directory of the link for the 2nd occurrence, not the file pointed at by the link (and this is inconsistent with what is in your screenshot).

Upvotes: 1

Roger Lipscombe
Roger Lipscombe

Reputation: 91925

If you do find in "Entire Solution", it also searches in any loaded files, even if they're already in the solution. This means that they'll be listed twice.

Perhaps this is your problem?

Upvotes: 5

Related Questions