Click to Rate and Give Feedback
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual Studio Automation and Extensibility Reference
Project Interface

Represents a project in the integrated development environment (IDE).

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)
Visual Basic (Declaration)
<GuidAttribute("866311E6-C887-4143-9833-645F5B93F6F1")> _
Public Interface Project
Visual Basic (Usage)
Dim instance As Project
C#
[GuidAttribute("866311E6-C887-4143-9833-645F5B93F6F1")]
public interface Project
Visual C++
[GuidAttribute(L"866311E6-C887-4143-9833-645F5B93F6F1")]
public interface class Project
JScript
public interface Project

Every project in the solution has a project automation interface. In rare cases, this is a generic, unmodeled project implementation that returns the project's name.

Every tool in the environment that has a project has a Project object.

Reference this object by using DTE.Solution.Item or by using a specific language's objects, such as DTE.VBProjects.Item, or DTE.VCProjects.Item.

x29xdte5.alert_note(en-us,VS.90).gifNote:

Project-specific objects such as DTE.VBProjects.Item and DTE.VCProjects.Item are located in other assemblies. Visual Basic and Visual C# project objects are located in VSLangProj, and Visual C++ project objects are located in Microsoft.VisualStudio.VCProjectEngine. See Extending Visual Basic and Visual C# Projects and Visual C++ Project Model for more information about programming against project-specific objects.

Visual Basic
Sub ProjectExample()
' This function creates a solution and adds a Visual Basic Console
' project to it. 
   Dim soln As Solution2
   Dim proj As Project
   Dim msg As String
' Create a reference to the solution.
   soln = DTE.Solution
' Create a new solution.
   soln.Create("c:\temp2", "MyNewSolution")
' Create a new Visual Basic Console application project. 
' Adjust the save path as needed.
   Dim fileN As String
   fileN = soln.GetProjectTemplate("ConsoleApplication.zip", "VisualBasic")
   proj = soln.AddFromTemplate(fileN, "c:\temp2", "My New Project", True)
   
' Save the new solution
   soln.SaveAs("c:\temp2\newsolution.sln")
   msg = "Created new solution: " & soln.FullName
   MsgBox(msg)
End Sub
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker