Solution3 インターフェイス

更新 : 2007 年 11 月

統合開発環境 (IDE: Integrated Development Environment) のすべてのプロジェクトとソリューション全体のプロパティを表します。Solution および Solution2 に代わるものです。

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

構文

'宣言
<GuidAttribute("DF23915F-FDA3-4DD5-9CAA-2E1372C2BB16")> _
Public Interface Solution3 _
    Implements Solution2
'使用
Dim instance As Solution3
[GuidAttribute("DF23915F-FDA3-4DD5-9CAA-2E1372C2BB16")]
public interface Solution3 : Solution2
[GuidAttribute(L"DF23915F-FDA3-4DD5-9CAA-2E1372C2BB16")]
public interface class Solution3 : Solution2
public interface Solution3 extends Solution2

解説

Solution3 オブジェクトは、IDE の現在のインスタンスに存在するすべてのプロジェクトと、ビルド構成などのソリューション全体のすべてのプロパティから構成されるコレクションです。Solution3 オブジェクトには、ラップ プロジェクト、サブプロジェクト、トップ レベルのプロジェクトのいずれであるかに関係なく、すべてのプロジェクトのプロジェクト要素が含まれます。

このオブジェクトを参照するには、DTE.Solution3 を使用します。MiscFiles や SolutionItems などの仮想プロジェクトを参照するには、Solution3.Item(EnvDTE.Constants.vsProjectKindMisc) または Solution3.Item(EnvDTE.Constants.vsProjectKindSolutionItems) を使用します。

このアドイン コードの実行方法については、「方法 : オートメーション オブジェクト モデルのコード例をコンパイルおよび実行する」を参照してください。

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)
    Solution3Example(_applicationObject)
End Sub

Sub Solution3Example(ByVal dte As DTE2)
    ' This function creates a solution and adds a Visual C# Console
    ' project to it.
    Try
        Dim soln As Solution3 = CType(DTE.Solution, Solution3)
        Dim csTemplatePath As String
        ' This path must exist on your computer.
        ' Replace <file path> below with an actual path.
        Dim csPrjPath As String = "<file path>"
        MsgBox("starting")
        ' Get the project template path for a C# console project.
        csTemplatePath = CType(soln.GetProjectTemplate _
        ("ConsoleApplication.zip", "CSharp"), string)
        ' Create a new C# Console project using the template obtained 
        ' above.
        soln.AddFromTemplate(csTemplatePath, csPrjPath, _
        "New CSharp Console Project", False)
        MsgBox("done")
    Catch ex As System.Exception
        MsgBox(ex.ToString)
    End Try
End Sub
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.
    Solution3Example((DTE2)_applicationObject);
}

public void Solution3Example(DTE2 dte)
{
    // This function creates a solution and adds a Visual C# Console
    // project to it.
    try{
        Solution3 soln = (Solution3)_applicationObject.Solution;
        String csTemplatePath;
        // The file path must exist on your computer.
        // Replace <file path> below with an actual path.
        String csPrjPath = "<file path>";
        "<file path>MessageBox.Show("Starting...");
        "<file path>"<file path>csTemplatePath = 
        soln.GetProjectTemplate("ConsoleApplication.zip", "CSharp");
        // Create a new C# Console project using the template obtained 
        // above.
        soln.AddFromTemplate(csTemplatePath, csPrjPath,
          "New CSharp Console Project", false);
        MessageBox.Show("Done!");
    }
    catch(SystemException ex)
    {
        MessageBox.Show("ERROR: " + ex);
    }
}

参照

参照

Solution3 メンバ

EnvDTE90 名前空間