Solution3 Interface

Represents all projects and solution-wide properties in the integrated development environment (IDE). Supersedes Solution and Solution2.

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


<GuidAttribute("DF23915F-FDA3-4DD5-9CAA-2E1372C2BB16")> _
Public Interface Solution3 _
    Inherits Solution2
public interface Solution3 : Solution2
public interface class Solution3 : Solution2
type Solution3 =  
        interface Solution2
public interface Solution3 extends Solution2

The Solution3 type exposes the following members.


  Name Description
Public property AddIns (Inherited from Solution2.)
Public property AddIns Gets an AddIns collection, which contains all currently available add-ins associated with the solution.
Public property Count (Inherited from Solution2.)
Public property Count Gets a value indicating the number of projects in the solution.
Public property DTE (Inherited from Solution2.)
Public property DTE Gets the top-level extensibility object.
Public property Extender[String] (Inherited from Solution2.)
Public property Extender[String] Gets the requested Extender object if it is available for this object.
Public property ExtenderCATID (Inherited from Solution2.)
Public property ExtenderCATID Gets the Extender category ID (CATID) for the object.
Public property ExtenderNames (Inherited from Solution2.)
Public property ExtenderNames Gets a list of available Extenders for the object.
Public property FileName (Inherited from Solution2.)
Public property FileName Infrastructure. Gets the file name.
Public property FullName (Inherited from Solution2.)
Public property FullName Gets the full path and name of the object's file.
Public property Globals (Inherited from Solution2.)
Public property Globals Gets the Globals object that contains any variable values that may be saved in the solution (.sln) file, the project file, or the user's profile data.
Public property IsDirty (Inherited from Solution2.)
Public property IsDirty Infrastructure. Determines whether the solution is dirty (modified but not saved).
Public property IsOpen (Inherited from Solution2.)
Public property IsOpen Gets whether a solution is open.
Public property Parent (Inherited from Solution2.)
Public property Parent Gets the immediate parent object of a Solution2 object.
Public property Projects (Inherited from Solution2.)
Public property Projects Gets a collection of the projects currently in the solution.
Public property Properties (Inherited from Solution2.)
Public property Properties Gets a collection of all properties that pertain to the Solution2 object.
Public property Saved (Inherited from Solution2.)
Public property Saved Gets or sets a value indicating whether a solution has not been modified since last being saved or opened.
Public property SolutionBuild (Inherited from Solution2.)
Public property SolutionBuild Gets the SolutionBuild object for the solution, which represents the root of the build automation model at the solution level.
Public property TemplatePath[String] (Inherited from Solution2.)
Public property TemplatePath[String] Superseded by GetProjectTemplate.



  Name Description
Public method AddFromFile(String, Boolean) (Inherited from Solution2.)
Public method AddFromFile(String, Boolean) Adds a project to the solution that is based on a project file already stored in the system.
Public method AddFromTemplate(String, String, String, Boolean) (Inherited from Solution2.)
Public method AddFromTemplate(String, String, String, Boolean) Copies an existing project file, and any items or subdirectories it contains, to the specified location and adds it to the solution.
Public method AddSolutionFolder(String) (Inherited from Solution2.)
Public method AddSolutionFolder(String) Adds a solution folder to a ProjectItems collection.
Public method Close(Boolean) (Inherited from Solution2.)
Public method Close(Boolean) Closes the current solution.
Public method Create(String, String) (Inherited from Solution2.)
Public method Create(String, String) Creates an empty solution in the specified directory with the specified name.
Public method FindProjectItem(String) (Inherited from Solution2.)
Public method FindProjectItem(String) Locates an item in a project.
Public method GetEnumerator() (Inherited from Solution2.)
Public method GetEnumerator() Returns an enumeration for items in a collection.
Public method GetProjectItemTemplate(String, String) (Inherited from Solution2.)
Public method GetProjectItemTemplate(String, String) Returns a path to the indicated project item template.
Public method GetProjectItemTemplates Returns a collection of project item templates for the specified project.
Public method GetProjectTemplate(String, String) (Inherited from Solution2.)
Public method GetProjectTemplate(String, String) Returns a path to the specified project template.
Public method Item(Object) (Inherited from Solution2.)
Public method Item(Object) Returns an indexed member of a Projects collection.
Public method Open(String) (Inherited from Solution2.)
Public method Open(String) Opens a specified solution.
Public method ProjectItemsTemplatePath(String) (Inherited from Solution2.)
Public method ProjectItemsTemplatePath(String) Superseded by GetProjectItemTemplate.
Public method Remove(Project) (Inherited from Solution2.)
Public method Remove(Project) Removes the specified project from the solution.
Public method SaveAs(String) (Inherited from Solution2.)
Public method SaveAs(String) Saves the solution.



The Solution3 object is a collection of all projects in the current instance of the IDE and all solution-wide properties, such as build configurations. The Solution3 object contains a project element for every project, whether it is a wrapped project, a subproject, or a top-level project.

Reference this object by using DTE.Solution. To refer to virtual projects, such as MiscFiles or SolutionItems, use Solution3.Item(EnvDTE.Constants.vsProjectKindMisc) or Solution3.Item(EnvDTE.Constants.vsProjectKindSolutionItems).


For information on how to run this add-in code, see How to: Compile and Run the Automation Object Model Code Examples.

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)
End Sub

Sub Solution3Example(ByVal dte As DTE2)
    ' This function creates a solution and adds a Visual C# Console
    ' project to it.
        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>"
        ' Get the project template path for a C# console project.
        csTemplatePath = CType(soln.GetProjectTemplate _
        ("", "CSharp"), string)
        ' Create a new C# Console project using the template obtained 
        ' above.
        soln.AddFromTemplate(csTemplatePath, csPrjPath, _
        "New CSharp Console Project", False)
    Catch ex As System.Exception
    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.

public void Solution3Example(DTE2 dte)
    // This function creates a solution and adds a Visual C# Console
    // project to it.
        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("", "CSharp");
        // Create a new C# Console project using the template obtained 
        // above.
        soln.AddFromTemplate(csTemplatePath, csPrjPath,
          "New CSharp Console Project", false);
    catch(SystemException ex)
        MessageBox.Show("ERROR: " + ex);

See Also


EnvDTE90 Namespace