This documentation is archived and is not being maintained.

AddInController Class

Provides access to an add-in for a variety of tasks.

Namespace:  System.AddIn.Hosting
Assembly:  System.AddIn (in System.AddIn.dll)

public sealed class AddInController

Use this class to perform the following tasks:

  • Use the AddInEnvironment property to obtain an AddInEnvironment object for an add-in. Then use that object to activate other add-ins in the same application domain and process as the original add-in.

  • Use the AppDomain property to obtain an AppDomain object for an add-in. Then use that object to activate other add-ins in the same application domain as the original add-in. Note that because of limitations in cross-process remoting, this scenario will not work with add-ins that are activated in a separate process.

  • Use the Token property to obtain an AddInToken object that represents an add-in.

  • Shut down an add-in with the Shutdown method.

To obtain the controller for an add-in, call the GetAddInController method and pass an instance of the add-in as its parameter.

The following example activates an add-in within the same environment as a previously activated add-in by using an AddInController object.

// Get the AddInController of a  
// currently actived add-in (CalcAddIn).
AddInController aiController = AddInController.GetAddInController(CalcAddIn);

// Select another token.
AddInToken selectedToken2 = ChooseAddIn(tokens);

// Activate a second add-in, CalcAddIn2, in the same 
// appliation domain and process as the first add-in by passing 
// the first add-in's AddInEnvironment object to the Activate method.
AddInEnvironment aiEnvironment = aiController.AddInEnvironment;
Calculator CalcAddIn2 =

// Get the AddInController for the second add-in to compare environments.
AddInController aiController2 = AddInController.GetAddInController(CalcAddIn2);
Console.WriteLine("Add-ins in same application domain: {0}", aiController.AppDomain.Equals(aiController2.AppDomain));
Console.WriteLine("Add-ins in same process: {0}", aiEnvironment.Process.Equals(aiController2.AddInEnvironment.Process));


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5