Share via


SolutionBuild2.BuildDependencies Property

Definition

Gets a BuildDependencies collection that allows you to specify which projects depend on which other projects.

public:
 property EnvDTE::BuildDependencies ^ BuildDependencies { EnvDTE::BuildDependencies ^ get(); };
[System.Runtime.InteropServices.DispId(4)]
public EnvDTE.BuildDependencies BuildDependencies { [System.Runtime.InteropServices.DispId(4)] get; }
[<System.Runtime.InteropServices.DispId(4)>]
[<get: System.Runtime.InteropServices.DispId(4)>]
member this.BuildDependencies : EnvDTE.BuildDependencies
Public ReadOnly Property BuildDependencies As BuildDependencies

Property Value

A BuildDependencies collection.

Implements

Attributes

Examples

This example creates a solution and adds a Visual C# console project to the solution. It then displays the number of build dependencies for the project.

Imports EnvDTE  
Imports EnvDTE80  
Sub SolutionBuild2DependExample(ByVal dte As DTE2)  
    Try  
        Dim soln As Solution2 = CType(_applicationObject.Solution _  
        , Solution2)  
        Dim csTemplatePath As String  
        Dim csPrjPath As String  
        Dim sb As SolutionBuild2  
        Dim bld As BuildDependencies  
        ' Make sure you create the folders that make up the path  
        ' on your computer. You can replace this with your own path.  
        csPrjPath = "C:\UserFiles\MyProjects\MyTestProject"  
        ' Get the project template path for a C# console project.  
        csTemplatePath = soln.GetProjectTemplate("Console Application"_  
        , "CSharp")  
        ' Create a new console project by using the   
        ' template obtained above.  
        soln.AddFromTemplate(csTemplatePath, csPrjPath, "newCSProj" _  
        , False)  
        sb = CType(soln.SolutionBuild, SolutionBuild2)  
        bld = sb.BuildDependencies  
        MsgBox("The project " & bld.Item(1).Project.Name & " has "  _  
        & bld.Count.ToString() & " build dependencies.")  
    Catch ex As System.Exception  
        MsgBox(ex.ToString)  
    End Try  
End Sub  
using EnvDTE;  
using EnvDTE80;  
using System.Windows.Forms;  
public void SolutionBuild2DependExample(DTE2 dte)  
{  
    try  
    {  
        Solution2 soln = (Solution2)_applicationObject.Solution;  
        String csTemplatePath;  
        String csPrjPath;  
        SolutionBuild2 sb;  
        BuildDependencies bld;  
        // Make sure you create the folders that make up the path  
        // on your computer. You can replace this with your own path.  
        csPrjPath = "C:\\UserFiles\\MyProjects\\MyTestProject";  
        // Get the project template path for a C# console project.  
        csTemplatePath = soln.GetProjectTemplate("Console Application",  
 "CSharp");  
        // Create a new console project by using the   
        // template obtained above.  
        soln.AddFromTemplate(csTemplatePath, csPrjPath, "newCSProj",  
 false);  
        sb = (SolutionBuild2)soln.SolutionBuild;  
        bld = sb.BuildDependencies;  
        MessageBox.Show("The project " + bld.Item(1).Project.Name   
+ " has " + bld.Count.ToString() + " build dependencies.");  
    }  
    catch (Exception ex)  
    {  
        MessageBox.Show(ex.Message);  
    }  
}  

Applies to