views:

85

answers:

1

I'm busy with a small, simple add-in, but the process seems massively complicated and badly documented. Right now, the only event that fires in the add-in is OnConnection. The other two I'm trying to handle just don't seem to exist.

    private DTE2 applicationObject;
    private SolutionEvents solutionEvents;

 public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
 {
        applicationObject = (DTE2)application;
     solutionEvents = ((Events2)applicationObject.Events).SolutionEvents;
        solutionEvents.Opened +=new _dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);    
 }
    private void SolutionEvents_Opened()
    {
        Debug.WriteLine("Solution loaded: " + applicationObject.Solution.FullName);
    }
+2  A: 

Umm, have you tried saving a copy of Events.SolutionEvents locally? I'm guessing that it could 'disappear' if there's no explicit reference to it in your add-in.

This is just a guess though :)

Dmitri Nesteruk
I have now; see my modified code, and I still only get OnConnection firing, and not even the intrinsic Connect 'events' like `OnStartupComplete`
ProfK
Maybe you should go the VSIP route: http://social.microsoft.com/Forums/en-US/vsx/thread/658102b9-0648-4c72-ac6d-00c7998879f4
Dmitri Nesteruk