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)

public interface Solution3 : Solution2

The Solution3 type exposes the following members.

Public propertyAddIns (Inherited from Solution2.)
Public propertyAddInsGets an AddIns collection, which contains all currently available add-ins associated with the solution.
Public propertyCount (Inherited from Solution2.)
Public propertyCountGets a value indicating the number of projects in the solution.
Public propertyDTE (Inherited from Solution2.)
Public propertyDTEGets the top-level extensibility object.
Public propertyExtender[String] (Inherited from Solution2.)
Public propertyExtender[String]Gets the requested Extender object if it is available for this object.
Public propertyExtenderCATID (Inherited from Solution2.)
Public propertyExtenderCATIDGets the Extender category ID (CATID) for the object.
Public propertyExtenderNames (Inherited from Solution2.)
Public propertyExtenderNamesGets a list of available Extenders for the object.
Public propertyFileName (Inherited from Solution2.)
Public propertyFileNameInfrastructure. Gets the file name.
Public propertyFullName (Inherited from Solution2.)
Public propertyFullNameGets the full path and name of the object's file.
Public propertyGlobals (Inherited from Solution2.)
Public propertyGlobalsGets 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 propertyIsDirty (Inherited from Solution2.)
Public propertyIsDirtyInfrastructure. Determines whether the solution is dirty (modified but not saved).
Public propertyIsOpen (Inherited from Solution2.)
Public propertyIsOpenGets whether a solution is open.
Public propertyParent (Inherited from Solution2.)
Public propertyParentGets the immediate parent object of a Solution2 object.
Public propertyProjects (Inherited from Solution2.)
Public propertyProjectsGets a collection of the projects currently in the solution.
Public propertyProperties (Inherited from Solution2.)
Public propertyPropertiesGets a collection of all properties that pertain to the Solution2 object.
Public propertySaved (Inherited from Solution2.)
Public propertySavedGets or sets a value indicating whether a solution has not been modified since last being saved or opened.
Public propertySolutionBuild (Inherited from Solution2.)
Public propertySolutionBuildGets the SolutionBuild object for the solution, which represents the root of the build automation model at the solution level.
Public propertyTemplatePath[String] (Inherited from Solution2.)
Public propertyTemplatePath[String]Superseded by GetProjectTemplate.

Public methodAddFromFile(String, Boolean) (Inherited from Solution2.)
Public methodAddFromFile(String, Boolean)Adds a project to the solution that is based on a project file already stored in the system.
Public methodAddFromTemplate(String, String, String, Boolean) (Inherited from Solution2.)
Public methodAddFromTemplate(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 methodAddSolutionFolder(String) (Inherited from Solution2.)
Public methodAddSolutionFolder(String)Adds a solution folder to a ProjectItems collection.
Public methodClose(Boolean) (Inherited from Solution2.)
Public methodClose(Boolean)Closes the current solution.
Public methodCreate(String, String) (Inherited from Solution2.)
Public methodCreate(String, String)Creates an empty solution in the specified directory with the specified name.
Public methodFindProjectItem(String) (Inherited from Solution2.)
Public methodFindProjectItem(String)Locates an item in a project.
Public methodGetEnumerator() (Inherited from Solution2.)
Public methodGetEnumerator()Returns an enumeration for items in a collection.
Public methodGetProjectItemTemplate(String, String) (Inherited from Solution2.)
Public methodGetProjectItemTemplate(String, String)Returns a path to the indicated project item template.
Public methodGetProjectItemTemplatesReturns a collection of project item templates for the specified project.
Public methodGetProjectTemplate(String, String) (Inherited from Solution2.)
Public methodGetProjectTemplate(String, String)Returns a path to the specified project template.
Public methodItem(Object) (Inherited from Solution2.)
Public methodItem(Object)Returns an indexed member of a Projects collection.
Public methodOpen(String) (Inherited from Solution2.)
Public methodOpen(String)Opens a specified solution.
Public methodProjectItemsTemplatePath(String) (Inherited from Solution2.)
Public methodProjectItemsTemplatePath(String)Superseded by GetProjectItemTemplate.
Public methodRemove(Project) (Inherited from Solution2.)
Public methodRemove(Project)Removes the specified project from the solution.
Public methodSaveAs(String) (Inherited from Solution2.)
Public methodSaveAs(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.

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);

Community Additions