Visual Studio 15 - Rename Error: No References were found in the selected scope

Solution 1:

As I mentioned above, the solution is to extend the scope. I am not sure why the scope does need to be extended though. The files are located inside the project and are part of the version control scope for this project.

Solution 2:

Extending the scope as you and others have suggested will only work in those cases when VS is actually recognizing your references. If "Find All References" (in whatever scope you prefer) works then renaming will also work (if you choose the correct scope).

But many times (happens to me frequently) this is a bug in VS, and unfortunately it's one that's still persisting even today with Visual Studio (Community) 2022 v17.0.5. It can present itself in weird ways, e.g. you can rename some things, but only one time. Other times you can't even rename a single local variable that only appear in two consecutively lines.

More info can be found from this question, and I'll quote the only solution that ever works for me when VS fails to keep track of the references:

  1. Close out of all instances of visual studio
  2. Locate the .vs hidden folder within your solution.
  3. Delete the entire hidden .vs folder.
  4. Rebuild the solution