次の方法で共有


SolutionBuild2.BuildDependencies プロパティ

プロジェクト間の依存関係を指定できる BuildDependencies コレクションを取得します。

名前空間:  EnvDTE80
アセンブリ:  EnvDTE80 (EnvDTE80.dll 内)

構文

'宣言
ReadOnly Property BuildDependencies As BuildDependencies
BuildDependencies BuildDependencies { get; }
property BuildDependencies^ BuildDependencies {
    BuildDependencies^ get ();
}
abstract BuildDependencies : BuildDependencies
function get BuildDependencies () : BuildDependencies

プロパティ値

型 : EnvDTE.BuildDependencies
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 名前空間