none
AddIn shows as loaded, but ThisAddIn_Startup is never called at application start RRS feed

  • Question

  • Hi,

    I created a SharePoint Designer 2010 Application Add-In. I only have a problem when the application first launches. If I go into the COM AddIns, the add-in shows that it loaded, but if I add a MessageBox.Show call in the ThisAddIn_Startup method, it's never called.

    If I clear the checkbox, click OK, then go back in and put a checkbox next to the add-in, the messagebox is displayed. I also have a ribbon tab that loads fine when the add-in is reset.

    I've added the suppress display alerts and logging to the registry, but I get no errors whatsoever when the application is loading.

    Thursday, April 12, 2012 7:13 PM

All replies

  • At first guess it sounds to me like a problem with providing a signing certificate on you add-in. How are you deploing the add-in?  Click-once or MSI install?

    Kind Regards, Rich ... http://greatcirclelearning.com

    Friday, April 13, 2012 2:34 AM
  • Hi Rich,

    Thanks for the response. I'm using an MSI Installer. I'm not inclined to think it's related to the installer because this also happens when debugging through Visual Studio.

    Thanks,

    Leeland

    Sunday, April 15, 2012 7:51 PM
  • Leeland, I will involve other engineers to see whether they can give you some suggestions about the problem. There might be some delay about the response. Appreciate your patience.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, April 17, 2012 4:16 AM
  • Hi Leeland,

    What Visual Studio 2010 template did you use to build a SharePoint Designer 2010 application add-in?

    Please refer to the content at the following links to see more information on Add-In events, especially about the VSTO classes and the ThisAddIn_Startup(...) event. It presumes VSTO classes provided by the project templates.

    - Programming Application-Level Add-Ins - MSDN – Explore Windows ...
    http://msdn.microsoft.com/en-us/library/bb157876.aspx

    - Events in Office Projects - MSDN – Explore Windows, Web, Cloud ...
    http://msdn.microsoft.com/en-us/library/7xy91eax.aspx
    (See the "Application-Level Projects" - "Startup event" topic )

    Someone else reported working around a similar problem thus: "I got ThisAddIn_Startup() to run by adding a call to: this.FinishInitialization() in the Initialize() method in ThisAddin.Designer.cs."  This dealt with a Word Application Level add-in project and was fixed by applying VS 2008 SP1.


    Chris Jensen

    Tuesday, April 24, 2012 2:44 PM
    Moderator
  • Hi Chris,

    Thanks for responding.

    Since there are no templates for SharePoint Designer 2010 Add-Ins, I modified the template for SharePoint Designer 2007 that is located on CodePlex (http://vsto.codeplex.com/).

    I went through the articles you listed and I'm not seeing anything that would cause this issue. I tried adding a call to this.FinishInitialization() within the Initialize() method. It did change the loading of the assembly, but not when I thought it would. After adding the FinishInitialization call, once I clicked on the "COM Add-ins" button, the ThisAddIn_Startup() method was called.

    However, the ribbon still did not display the xml ribbon I created. I verified that the CreateRibbonExtensibilityObject method was being called, but it was still not being displayed.

    When I unload and reload the assembly now, the ThisAddIn_Startup() method is called 3 times and the Ribbon shows as expected.

    Leeland

    Tuesday, April 24, 2012 3:52 PM
  • Hi Leeland,

    Try removing the call to this.FinishInitialization.

    The template in CodePlex is for Visual Studio 2008.  The VSTO Templates for VS 2010 are different and your problem probably results from differences in the classes and events in the two versions.

    You looked at this article, but please review it one more time: The StartUp_Complete( ) is fired after all modules of the host application have completed the load and activate steps. A change in the event sinks in the two versions of the classes provided by the template - or SharePoint may load and initialize differently from the Office applications.
    - Events in Office Projects - MSDN – Explore Windows, Web, Cloud ...
    http://msdn.microsoft.com/en-us/library/7xy91eax.aspx
    (See the "Application-Level Projects" - "Startup event" topic )


    Chris Jensen

    Tuesday, April 24, 2012 6:34 PM
    Moderator