Locate File/Track Active Item in Solution Explorer

Referred from: Locate File in Solution Explorer – Visual Studio Macro

Toogle “Track Active Items” (Tools –> Options –> Projects and Solutions).
This feature, when enabled, syncs the selected item in your solution explorer to the file being viewed.The below Macro will assist you finding the current file while leaving the feature turned off.
Go to Tool-Options-Environment-Keyboard and bind it to a shortcut key and you are all set – mine is bound to (ALT+L, ALT+L) or (Ctrl-`). To see your macro, type its name in the search box.
Public Sub LocateFileInSolutionExplorer()
  DTE.ExecuteCommand("View.TrackActivityinSolutionExplorer")
  DTE.ExecuteCommand("View.TrackActivityinSolutionExplorer")
  DTE.ExecuteCommand("View.SolutionExplorer")
End Sub

To add a macro (in Visual Studio 2008), browse to Tool – Macro – Macro Explorer, then select/create a module and open it, then paste the script above and save. That’s it.

Enjoy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: