Export (0) Print
Expand All

Project Object

Visual Studio .NET 2003

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

DTE

   Projects

      Project

[Visual Basic .NET]
Public Interface Project
    Inherits IDispatch
[Visual Basic 6]
Class Project
[C++]
interface Project : IDispatch
[C#]
public interface Project : IDispatch
[JScript .NET]
public interface Project extends IDispatch

Remarks

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 using DTE.Solution.Item, or using a specific language's objects, such as DTE.VBProjects.Item, or DTE.VCProjects.Item.

Requirements

Namespace: EnvDTE

File: dte.tlb

Example

Sub ProjectExample()
   'This function creates a solution and adds a Visual Basic .NET Console
   'project to it. 
   Dim soln As Solution
   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 VB Console application project. Adjust the save path as 
   'needed.
   proj = soln.AddFromTemplate("C:\Program Files\Microsoft Visual Studio .NET\Vb7\VBWizards\ConsoleApplication\Templates\1033\ConsoleApplication.vbproj", "c:\temp2", "My New Project", True)
   ' Save the new solution and project.
   soln.SaveAs("c:\temp2\newsolution.sln")
   msg = "Created new solution: " & soln.FullName & vbCrLf
   msg = msg & "Created new project: " & proj.Name
   MsgBox(msg)
End Sub

See Also

ProjectItem Object | Projects Collection

Properties, Methods, and Events

Show:
© 2014 Microsoft