First I found this blog post – which worked but only after some tinkering. There is a comment there that describes a better (simpler) solution, IMO.
Step 1: Create the following macro, which simply toggles (twice) the existing TrackActivityinSolutionExplorer command – this is the same command that happens if you turn on solution explorer tracking in Visual Studio options, except here we’re turning it on and then immediately off:
Public Sub SelectCurrentItemInSolutionExplorer()
DTE.ExecuteCommand(“View.TrackActivityinSolutionExplorer”)
DTE.ExecuteCommand(“View.TrackActivityinSolutionExplorer”)
End Sub
Step 2: Create a toolbar button to run this macro. To do this, right click on the toolbar and click customize. Click “New…” to create a new toolbar, I took the default name of “Custom 1”. Go to the “Commands” tab and click the “Toolbar” radio button, select your new toolbar from the dropdown list. Click “Add Command…”, select Macros from the categories list and select your new “SelectCurrentItemInSolutionExplorer” macro as the command. Click “OK’”, then you can “Modify Selection” to give it a custom name or image.