Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Solution2.AddIns Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets an AddIns collection, which contains all currently available Add-ins associated with the solution.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)
AddIns AddIns { get; }

Property Value

Type: EnvDTE.AddIns
An AddIns collection.

Only registered Add-ins appear in the AddIns collection, and they load and unload when the solution loads and unloads.

For information on how to run this add-in code, see How to: Compile and Run the Automation Object Model Code Examples.

The following example counts the number of add-ins in an open solution.

//you will need to add this reference to your project as well
using System.Windows.Forms;
public void OnConnection(object application,
 Extensibility.ext_ConnectMode connectMode, object addInInst,
 ref System.Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    // Pass the applicationObject member variable to the code example.
    SolutionAddInsExample((DTE2)_applicationObject);
}
public void SolutionAddInsExample(DTE2 dte)
{
    // This add-in counts the add-ins in a solution.
    // Open a solution in Visual Studio before running this
    // example..
    try{
        Solution2 soln =(Solution2)_applicationObject.Solution;
        // List the number of Add-ins.
        MessageBox.Show("Number of add-ins in" + soln.FullName 
+ " is: " + "\n" + soln.AddIns.Count);
    }
    catch(SystemException ex)
    {
        MessageBox.Show("ERROR: " + ex);
    }
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.