I am writing a customization package for Visual Studio 2010 (vsix).
What I need to do is to add a context menu button to the Project nodes in Solution Explorer.
I've managed to get the context menu to appear when right-clicking the Project nodes, but my next challenge is to get a reference to the Project object that's been clicked. Currently I am able to get the project by going through the active document in the IDE using the code below.
DTE dte = (DTE)ServiceProvider.GlobalProvider.GetService(typeof(DTE));
Project project = dte.ActiveDocument.ProjectItem.ContainingProject;
So my question is: how do I get a similar reference to the project selected in the solution explorer?