Introduction to the VSProject2 Object
The VSProject2 object provides access to the Visual Basic and Visual C# project structure.
Following are the properties and methods specific to Visual Basic and Visual C#:
The Imports property contains a collection of all the project-level Imports statements in a Visual Basic project. Adding an Imports statement to this collection is equivalent to adding the same statement to each code file in the project. This property makes sense in a Visual Basic project only. For more information, see Imports.
The References property contains a collection of all references in a project. For more information, see References and Responding to Events (Visual Basic and Visual C# Projects).
The WebReferencesFolder property, which is a ProjectItem object, contains a collection of all Web references in the project in its ProjectItems property. You can use the CreateWebReferencesFolder method to create this project item and then add Web references by using the AddWebReference method.
The WorkOffline property is obsolete.
To copy projects, use the CopyProject method.
The Refresh method updates Solution Explorer after changes are made to the project.
The BuildManager property provides access to the temporary portable executables needed to implement custom tools and designers. For more information, see Introduction to the BuildManager Object and BuildManager.
The VSProject2 object also has properties to help you work your way back to objects in the general extensibility model. These properties include:
The DTE property returns the top-level extensibility object. You have access to the entire Visual Studio extensibility object model through this property.
The Project property returns the general extensibility object for the project. This object includes properties, methods, and events that are common to all Visual Studio projects.
The following table provides links to topics that detail how to use the VSProject2 object to create and control Visual Basic and Visual C# projects.
Create Visual C# and Visual Basic projects, use .zip-files to add project items, use the VSProject2 object to control the project.