Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 "Find All References" only searches opened files

Recently I have Visual Studio 2015 installed (Microsoft Visual Studio Community 2015 Version 14.0.25425.01 Update 3), opened a simple website with it, and found that the "Find All References" only searches opened files.

Everything works fine in Visual Studio 2013 for the same website.

Then I created a new website in Visual Studio 2015, "Find All References" was still not working properly. So I wondering there's nothing to do with my own website, it the Visual Studio's problem.

I've googled it and tried the following:

  • make sure the framework versions of the website and Visual Studio config are both 4.0
  • Tools -> Import & Export Settings -> Reset All Settings
  • check the OUTPUT window and saw no error
  • delete the .suo file and rebuild
  • Tools -> Options -> Text Editor -> File Extension, add .cs for c#
  • reinstall the Visual Studio
  • clear Visual Studio cache
  • maybe others I don't remember cause I'm struggling with this for almost two days

Sorry for my poor English and Thank you for any help!


Update1. more details about the issue:

By "only searches opened files", I meant, when searching an identifier using Find All References, if files were opened, occurrences of the identifier in the files can be found, or else, the occurrences were ignored.

Say, there are an identifier foo(), and a file callfoo.cs which calls the foo(). Right-click the foo(), select Find All References.

If the callfoo.cs was opened in text editor already, the occurrence of foo() in it can be found, and displayed in the Find Symbol Results window, or else, it returns (0 references).

What's expected is that no matter the callfoo.cs was opened or not, the occurrence of foo() should be found and displayed in the Find Symbol Results window.

like image 219
Sven Zcc Avatar asked Sep 15 '16 12:09

Sven Zcc


1 Answers

This is how "Websites" work, it is by design.

When creating a new solution, if you go to "New / Project" in Visual Studio - rather than "New / Website" - you will be able to select a project type that is aware of all references.

I do however think that Visual Studio should just do a "manual search" of the current website to find references - that it doesn't is just lazy and inconvenient.

A workaround would be to just search the solution for the name of the method.

like image 138
niico Avatar answered Sep 17 '22 15:09

niico