Export (0) Print
Expand All

SolutionBuild2.SolutionConfigurations Property

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

Gets a collection of SolutionConfiguration objects.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

SolutionConfigurations SolutionConfigurations { get; }

Property Value

Type: EnvDTE.SolutionConfigurations
A SolutionConfigurations collection.

This example sets the first solution configurations item to "release" and then builds the solution. Open a project in the Visual Studio integrated development environment (IDE) before running this add-in.

For more information about how to run this example as an add-in, see How to: Compile and Run the Automation Object Model Code Examples.

using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public void OnConnection(object application, 
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    SolutionConfigurationsExample(_applicationObject);
}
public void SolutionConfigurationsExample(DTE2 dte)
{
    try
    {
        Solution2 soln = (Solution2)_applicationObject.Solution;
        SolutionBuild2 sb;
    BuildDependencies bld;
        // Open a solution in Visual Studio before 
        // running this example.
        sb = (SolutionBuild2)soln.SolutionBuild;
        bld = sb.BuildDependencies;
        MessageBox.Show("The project " + bld.Item(1).Project.Name 
+ " has " + bld.Count.ToString() + " build dependencies.");
        MessageBox.Show("Set the configuration to release 
and build...");
        sb.SolutionConfigurations.Item("Release").Activate();
        sb.Build(true);
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

Show:
© 2014 Microsoft