This documentation is archived and is not being maintained.

IDTExtensibility2.OnAddInsUpdate Method

Occurs whenever an add-in is loaded or unloaded from the Visual Studio integrated development environment (IDE).

Namespace: Extensibility
Assembly: Extensibility (in extensibility.dll)

void OnAddInsUpdate (
	[InAttribute] ref Array custom
)
void OnAddInsUpdate (
	/** @attribute InAttribute() */ /** @ref */ Array custom
)
JScript does not support passing value-type arguments by reference.

Parameters

custom

An empty array that you can use to pass host-specific data for use in the add-in.

This method is most often used to enforce dependencies on other add-ins. That is, if an add-in requires the presence of another add-in (or other program) before it can run properly, you can check the status with this method.

An add-in triggers the OnAddInsUpdate event when an add-in loads in the environment for the first time in that session, and whenever the OK button in the Add-In Manager is clicked. It does not trigger when an add-in is loaded by a command or when it is loaded by way of its Connected property.

To obtain the name of the add-in that has changed, iterate through the AddIns collection and check each add-in's Connected property. You can access each add-in by using either its ProgID or 1-based index value. If the index does not exist, an "invalid index" COMException error occurs. Otherwise, it returns an AddIn reference.

public void OnAddInsUpdate(ref Array custom)
{
    try
    {
        AddIn addIn = this.dte.addins.item("MyAddin1.Connect");
        if (addInInstance.Connected == true)
        {
            System.Windows.Forms.MessageBox.Show("This add-in is 
            connected.");
        }
        else
        {
            System.Windows.Forms.MessageBox.Show("This add-in is not 
            connected.");
        }
    }

    catch (COMException)
    {
         System.Windows.Forms.MessageBox.Show("Not a registered add-
         in.");
    }
}
Show: