Project.ParentProjectItem 属性

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

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

语法

声明
ReadOnly Property ParentProjectItem As ProjectItem
    Get
ProjectItem ParentProjectItem { get; }
property ProjectItem^ ParentProjectItem {
    ProjectItem^ get ();
}
abstract ParentProjectItem : ProjectItem
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 命名空间

其他资源

控制项目和解决方案