0

I'm trying to reload add-in to handle my own update runtime (using click once deployment API, but to provide silend updates)

But I've stucked on reloading add-in. My current task is just simple unload and reload add-in. What I found was similar to this:

private void Reload()
    {
        try
        {
            COMAddIns comAddIns = Globals.ThisAddIn.Application.COMAddIns;
            COMAddIn addIn =
                comAddIns.Cast<COMAddIn>().FirstOrDefault(addin => string.Equals(addin.Description, "OutlookAddIn1", StringComparison.OrdinalIgnoreCase));

            if (addIn != null)
            {
                addIn.Connect = false;
                addIn.Connect = true;
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }
    }

But this simple crashes on:

addIn.Connect = false;

I tried put this inside additonal try/catch block but it is not working. While calling Connect = false I have ThreadAbortException, that I cannot prevent to happen.

I would simple disable and enable add-in from code, at this moment which I cannot achieve.

Marcin
  • 3,232
  • 4
  • 31
  • 48

1 Answers1

0

AFAIK that is not possible since Connect = false tells the hosting runtime to throw your thread away... you could deliver 2 AddIns (the real one and a second which strictly handles the update only, each AddIn could handle the update of the other one for example)...

Yahia
  • 69,653
  • 9
  • 115
  • 144