ProjectItems Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Contains ProjectItem objects, each representing items in the project.
public interface class ProjectItems : System::Collections::IEnumerable
[System.Runtime.InteropServices.Guid("8E2F1269-185E-43C7-8899-950AD2769CCF")]
[System.Runtime.InteropServices.TypeLibType(4160)]
public interface ProjectItems : System.Collections.IEnumerable
[System.Runtime.InteropServices.Guid("8E2F1269-185E-43C7-8899-950AD2769CCF")]
public interface ProjectItems : System.Collections.IEnumerable
[<System.Runtime.InteropServices.Guid("8E2F1269-185E-43C7-8899-950AD2769CCF")>]
[<System.Runtime.InteropServices.TypeLibType(4160)>]
type ProjectItems = interface
interface IEnumerable
[<System.Runtime.InteropServices.Guid("8E2F1269-185E-43C7-8899-950AD2769CCF")>]
type ProjectItems = interface
interface IEnumerable
Public Interface ProjectItems
Implements IEnumerable
- Attributes
- Implements
Examples
' Before running, create a new project or open an existing project.
Sub ListProj()
Dim proj As Project = DTE.ActiveSolutionProjects(0)
Dim win As Window = _
DTE.Windows.Item(Constants.vsWindowKindCommandWindow)
ListProjAux(proj.ProjectItems(), 0)
End Sub
Sub ListProjAux(ByVal projitems As ProjectItems, ByVal Level As Integer)
Dim projitem As ProjectItem
For Each projitem In projitems
MsgBox("Project item: " & projitem.Name, Level)
' Recurse if the project item has sub-items...
Dim projitems2 As ProjectItems projitems2 = projitem.ProjectItems
Dim notsubcoll As Boolean = projitems2 Is Nothing
If Not notsubcoll Then
ListProjAux(projitems2, Level + 1)
End If
Next
End Sub
Remarks
This collection consists of a hierarchical (nested) structure of cascading ProjectItems collections that represent items in each project.
Reference this collection using Solution.Item().ProjectItems
.
Properties
ContainingProject |
Gets the project hosting the project item or items. |
Count |
Gets a value indicating the number of objects in the collection. |
DTE |
Gets the top-level extensibility object. |
Kind |
Gets an enumeration indicating the type of object. |
Parent |
Gets the immediate parent object of a ProjectItems collection. |
Methods
AddFolder(String, String) |
Creates a new folder in Solution Explorer. |
AddFromDirectory(String) |
Adds one or more ProjectItem objects from a directory to the ProjectItems collection. |
AddFromFile(String) |
Adds a project item from a file that is installed in a project directory structure. |
AddFromFileCopy(String) |
Copies a source file and adds it to the project. |
AddFromTemplate(String, String) |
Creates a new project item from an existing item template file and adds it to the project. |
GetEnumerator() |
Returns an enumeration for items in a collection. |
Item(Object) |
Returns a ProjectItem object in a ProjectItems collection. |