Compartir a través de


Controlling the Solution and Its Projects

Visual Studio add-ins are deprecated in Visual Studio 2013. You should upgrade your add-ins to VSPackage extensions. For more information about upgrading, see FAQ: Converting Add-ins to VSPackage Extensions.

One solution can be open in Visual Studio at any given time. If it is not an empty solution, it contains one or more projects. The projects can be of various types written in any of the Visual Studio languages. For example, a solution might contain a Visual Basic Windows application project and a Visual C++ ATL project. Each project, in turn, contains one or more project items, such as interfaces, classes, modules, forms, user controls, XML schema files, and so forth.

The Visual Studio automation model offers objects to programmatically create and manipulate all of these elements. The key object for controlling a solution and its contents is the Solution2 object. Using it, you can:

  • Create new solutions.

  • Add new projects to the solution, based on Visual Studio templates.

  • Add existing projects to the solution from files.

  • Remove projects from the solution.

  • Open, save, and close the solution.

  • Add new project items to projects.

  • Obtain information about the solution and the projects and project items it contains.

In addition to this set of language-agnostic project types, each Visual Studio language offers its own more specific project object model, which is specific to its host language. For example, there is a project-specific automation model for Visual Basic and Visual C#, contained in VSLangProj, VSLangProj2, VSLangProj80, VSLangProj90, and VSLangProj100. The project-specific automation model for Visual C++ is contained in Microsoft.VisualStudio.VCProject and Microsoft.VisualStudio.VCProjectEngine.

In This Section