Share via


VSProjectItem.ProjectItem Property

Definition

Gets the ProjectItem object associated with the given object.

public:
 property EnvDTE::ProjectItem ^ ProjectItem { EnvDTE::ProjectItem ^ get(); };
public:
 property EnvDTE::ProjectItem ^ ProjectItem { EnvDTE::ProjectItem ^ get(); };
[System.Runtime.InteropServices.DispId(2)]
public EnvDTE.ProjectItem ProjectItem { [System.Runtime.InteropServices.DispId(2)] get; }
[<System.Runtime.InteropServices.DispId(2)>]
[<get: System.Runtime.InteropServices.DispId(2)>]
member this.ProjectItem : EnvDTE.ProjectItem
Public ReadOnly Property ProjectItem As ProjectItem

Property Value

Returns a ProjectItem object.

Attributes

Examples

Sub PrjItem(ByVal dte As DTE2)  
    ' List the name of the first VSProjectItem.  
    ' Before running, open a VB or C# application in VS.  
    Dim vsPrj As VSProject = _  
    CType(dte.Solution.Projects.Item(1).Object, VSProject)  
    Dim vsPrjItem As VSProjectItem  

    vsPrjItem = CType(dte.Solution.Projects.Item(1) _  
    .ProjectItems.Item(1).Object, VSProjectItem)  
    MsgBox("Proj Item Name: " & vsPrjItem.ProjectItem.Name)  
End Sub  
public void PrjItem(DTE2 dte)  
{  
    // List the name of the first VSProjectItem.  
    // Before running, open a VB or C# application in VS.  
    VSProject vsPrj = (VSProject)dte.Solution.Projects.Item(1).Object;  
    VSProjectItem vsPrjItem;  

    vsPrjItem = (VSProjectItem)dte.Solution.Projects.Item(1).  
    ProjectItems.Item(1).Object;  
    MessageBox.Show("Proj Item Name: " + vsPrjItem.ProjectItem.Name);  
}  

Applies to