views:

128

answers:

1

Hi!

How can I programmatically refresh Visual Studio Solution Explorer?

I can get a hold of the solution explorer window object, but don't know what to do with it!

var solutionExplorer = (UIHierarchy)DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object();

Thanks.

+1  A: 

Usually you can figure out these things by recording a temporary macro, doing what you want to do, and seeing what comes out in the macro editor.

Indeed, this is a case where it's probably only by recording a temporary macro that you can figure out how to do this. Here's the command to refresh the Solution Explorer:

DTE.Commands.Raise("{1496A755-94DE-11D0-8C3F-00C04FC2AAE2}", 222, null, null)
Kyralessa
Thanks a lot! I used your trick (macro). I had to add a line prior to yours to make it worked: DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate();
joerage