Behind the scenes, when a VSTO addin or customization loads, the runtime uses reflection to search for all Ribbon controls and customizations and automatically adds them to the appropriate extension regions. This process makes it easy for developers as they don’t have to worry about hooking up the Ribbon Tab that they’ve developed to the Ribbon, or add a new menu item to the Office Menu. However, it can make the add-in’s startup time slower if your Office solution has many references and assemblies.

You can avoid this behavior by overriding one of the 2 methods below in your ThisAddin class:

protected override Office.IRibbonExtensibility 
    return null;

This is good for when you have no Ribbon objects in your project. The code explicitly tells the runtime “These are not the droids Ribbon Objects you are looking for”

protected override IRibbonExtension[] CreateRibbonObjects()
    return new IRibbonExtension[] { new Ribbon1(), new Ribbon2() };

This is good for when you do have Ribbon objects in your projects

Stephen Peters has a good blog post explaining in more detail what the runtime is doing behind the scenes

1 Comment