85

When I have an open code file in Visual Studio that I am editing I would like to keep that same file highlighted inside of the solution Explorer so that I know where I am at.

What I'd really like is to change the focus to a different code file and the solution explorer to move to the file that I am editing.

Further Explanation and example:

  • I have a project with 2 files: Class1 and Class2.
  • I open both files. The focus is on Class1.
  • I click on the Class2 Tab, thereby changing the file that I am editing to Class2.

Desired Behavior: The solution explorer will highlight Class2.

3 Answers 3

124

Tools - Options - Projects and Solutions - General - Track Active Item In Solution Explorer

I don't have full Visual Studio, only the Express Editions, where it seems to be checked by default for VB.NET and unchecked by default in C++.NET.

3
  • 7
    It's not immediately clear that when you turn this option off in VS2012 (maybe 2010 as well), you get a 'Sync' button in the solution explorer. This prevents your solution view from jumping all over the place and expanding the source tree to each new file, which drives me nuts when I'm following references through a larger project. This is what osh's answer is all about, but I thought it was worth noting that the same option controls/hides the sync button in later versions. Now if I can just set up a keybinding...
    – Patrick M
    Sep 10, 2013 at 17:14
  • @PatrickM I'm not sure if it was possible in older versions but you can set a keybinding in VS2013 and 2015; Tools > Options > Environment > Keyboard. The command you're looking for is 'View.TrackActivityinSolutionExplorer'. Nov 10, 2015 at 11:33
  • Waah, I have this ticked and it still doesn't synchronise. I've checked, and the file is included in the project. I actually ended up turning this option OFF, and then pressing the newly-appeared SYNC button, which was the only way I could get it to work.
    – Matt
    Feb 24, 2016 at 19:47
11

I prefer using the Solution Explorer Tools extension. It allows me to work most of the time without syncying code with solution explorer. when I want to sync I just press the sync button on the solution explorer. It can be downloaded here.

2
  • 2
    Welcome to Super User! It would be nice to include the essential parts of the answer here, and provide the link only for future reference.
    – slhck
    Mar 31, 2012 at 12:44
  • Nice! Just what I was looking for- Did not want the old VS2008 style jumping all over the place - only when i need it. +1 (VS2012 has this built in ;)
    – Piotr Kula
    Aug 30, 2012 at 8:57
9

"CTL + '[', S" will synchronize the solution explorer with the file in the current edit window.

1
  • 1
    note: if you have used the "Search Solution Explorer" textbox above the list of files, the required file may be missing from the visible list, so you need to clear the search box first before using the sync "arrows button" or the keyboard shortcut
    – Ekus
    Aug 2, 2018 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.