Share via


SolutionBuild2.BuildDependencies 속성

프로젝트의 종속 관계를 지정할 수 있는 BuildDependencies 컬렉션을 가져옵니다.

네임스페이스:  EnvDTE80
어셈블리:  EnvDTE80(EnvDTE80.dll)

구문

‘선언
ReadOnly Property BuildDependencies As BuildDependencies
    Get
BuildDependencies BuildDependencies { get; }
property BuildDependencies^ BuildDependencies {
    BuildDependencies^ get ();
}
abstract BuildDependencies : BuildDependencies
function get BuildDependencies () : BuildDependencies

속성 값

형식: EnvDTE.BuildDependencies
BuildDependencies 컬렉션

구현

SolutionBuild.BuildDependencies

예제

이 예제에서는 솔루션을 만들고 Visual C# 콘솔 프로젝트를 솔루션에 추가합니다. 그런 다음 프로젝트의 빌드 종속 항목 수를 표시합니다.

이 예제를 추가 기능으로 실행하는 방법에 대한 자세한 내용은 방법: 자동화 개체 모델 코드의 예제 컴파일 및 실행을 참조하십시오.

Imports EnvDTE
Imports EnvDTE80
Public Sub OnConnection(ByVal application As Object, _
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    _applicationObject = CType(application, DTE2)
    _addInInstance = CType(addInInst, AddIn)
    SolutionBuild2DependExample(_applicationObject)
End Sub
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 OnConnection(object application, 
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    SolutionBuild2DependExample(_applicationObject);
}
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);
    }
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

SolutionBuild2 인터페이스

BuildDependencies 오버로드

EnvDTE80 네임스페이스