Project.ParentProjectItem 属性

获取宿主项目中嵌套项目的 ProjectItem 对象。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

声明
ReadOnly Property ParentProjectItem As ProjectItem
ProjectItem ParentProjectItem { get; }
property ProjectItem^ ParentProjectItem {
    ProjectItem^ get ();
}
abstract ParentProjectItem : ProjectItem with get
function get ParentProjectItem () : ProjectItem

属性值

类型:EnvDTE.ProjectItem
一个 ProjectItem 对象。

备注

Visual Studio对于某些项目,如企业级模板项目允许包括其他项目作为项,具体而言,作为子项目。 每个这些项目是一个模板,用于企业应用程序,并且包含Visual Basic和Visual C++子项目。 如果您有这种项目接口或包装的项目,然后ParentProjectItem返回ProjectItem是包装的项目的模板项目中的项的对象。

示例

Sub ParentProjectItemExample()
   Dim proj As Project
   Dim projitems As ProjectItems
   Dim msg As String

   ' Reference the current solution and its projects and project items.
   proj = DTE.ActiveSolutionProjects(0)
   projitems = proj.ProjectItems

   ' List properties of the project and its items.
   msg = "Is the item open? " & projitems.Item(1).IsOpen & Chr(13)
   msg = msg & "The project's unique name: " & proj.UniqueName
   ' The following two properties work only if the current project 
   ' contains subprojects. If it does, then uncomment the lines to run 
   ' them.
   ' msg = msg & "The parent project item name: " & proj.ParentProjectItem.Name & Chr(13)
   ' msg = msg & "The subproject name: " & projitems.Item(1).SubProject.Name & Chr(13)
   MsgBox(msg)
End Sub

.NET Framework 安全性

请参阅

参考

Project 接口

EnvDTE 命名空间

其他资源

控制项目和解决方案