316

Normally, many files in Visual Studio 2010 are opened in many tabs, while massively working on a project. Many times, I find myself right-clicking on a tab title and searching for Show/Select/Scroll-to this file in Solution Explorer, and I can't find it.

Is there a way to automatically select an opened file in Solution Explorer?

1
  • 6
    Yeah, I keep almost turning back on the "Track Active Item in Solution Explorer", then I remember how much I disliked that, because I'd lose track of the section of the project I was working on. However, I also often want to on-demand "focus-to" the document I'm editing, to see all the items in nearby namespaces. For example, maybe I've just gone 5 references deep in a project I don't know well, using F12 (Go to definition). I don't want 5 trees open so I can't get back to my focal project, but I now want to inspect the third-party library for a moment.
    – shannon
    Commented Mar 18, 2011 at 20:31

14 Answers 14

448

Visual Studio 2013, 2015, 2017, 2019 and 2022+

One option is to bind 'View.TrackActivityInSolutionExplorer' to a keyboard short-cut, which is the same as ToolsOptionsProjects and SolutionsTrack Active Item in Solution Explorer'

If you activate the short-cut twice the file is selected in the solution explorer, and the tracking is disabled again.

Visual Studio 2013, 2015, 2017

There is now a feature built in to the Visual Studio 2013 Solution Explorer called Sync with Active Document. The icon is two arrows in the solution explorer, and has the hotkey Ctrl + [, S to show the current document in the solution explorer. Does not enable the automatic setting mentioned above, and only happens once.

This icon was then subsequently dropped again in VS 2019 and 2022.

6
  • 3
    Keyboard binding is done in Tools/Options.../Environment/Keyboard -- I went with binding Ctrl+Alt+] (close square bracket). Commented May 9, 2012 at 19:06
  • 4
    'Tools-->Options-->Projects and Solutions-->Track Active Item in Solution Explorer' still works in Visual Studio 2017 Community Edition. Commented Jun 21, 2018 at 16:49
  • 1
    'Tools-->Options-->Projects and Solutions-->Track Active Item in Solution Explorer' still works in Visual Studio 2019 Commented Apr 25, 2019 at 9:25
  • Why is this not enabled by default? Commented Jun 4, 2021 at 18:45
  • 2
    'Tools-->Options-->Projects and Solutions-->Track Active Item in Solution Explorer' still works in Visual Studio 2022
    – Bondolin
    Commented Jan 5, 2023 at 15:57
246

I don't know if you can do it on-demand, but you can enable the option "Track Active Item in Solution Explorer" (Tools->Options->Projects and Solutions->General) which will always select the active tab item in the solution explorer.

1
  • 10
    More precisely: Tools -> Options -> Projects and Solutions -> General ->
    – Barton
    Commented May 29, 2012 at 18:44
43

If you're using the ReSharper plugin, you can do that using the Shift + Alt + L shortcut or navigate via menu as shown.

Enter image description here

0
34

This isn't exactly what you're looking for, but it would automatically select the "active" file in the Solution Explorer:

Tools-->Options-->Projects and Solutions-->Track Active Item in Solution Explorer.

17

simply Tools--> Options--> Projects and Solutions--> Track Active Item in Solution Explorer

1
  • hope it help any one need it
    – Baraa Deek
    Commented Aug 30, 2021 at 8:00
11

In visual studio 2022

Similar to this answer https://stackoverflow.com/a/8473574/13275637

You need to tick Track Active Item in solution Explorer

enter image description here

9

The best option now is to install the Microsoft Visual Studio add on called Productivity Power Tools.

With this comes "Solution Navigator" (alternative to Solution Explorer, with a lot of benefits) - which then you can use to filter the files to only show "Open". You can even filter files to show "Edited" and "Unsaved".

0
8

It's in VS2012 - Specifically the 2-Arrow icon at the top of the solution explorer (Left/Right arrows, one above the other). This automatically jumps to the current file.

This icon is only visible if you've got Track Active Item in Solution Explorer disabled.

8

In VS 2019 select Tools > Options and then tick "Track Active Item in Solution Explorer" enter image description here

5

In Visual Studio 2012, the same can be done using the "Sync With Active Document" option in Solution Explorer

0
3

The Tab Studio plugin adds "select in solution explorer" to the right click menu on tabs.

1
  • i knew i saw it somewhere... thanks for pointing it out it was in tabstudio (which i had installed) Commented Jan 8, 2013 at 6:51
2

There's a very nice extension to VS2010, which does exactly this: Solution Explorer Tools.

This extension adds a button which selects the current file in the solution explorer, as well as convenient buttons for collapsing and expanding projects.

2

That's the screenshot of the answer for your question.

1

I've put in a feature request for this very feature. Although I know this isn't an answer in itself it is a step in the direction of being able to get this feature implemented. Any votes it it may help to get Microsoft's attention.

As far as I'm aware of though there is no way to do this other than possibly writing a macro or creating your own add-in/extension to Visual Studio.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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