Reference.ContainingProject 屬性
取得選定項目所屬專案。唯讀。
命名空間: VSLangProj
組件: VSLangProj (在 vslangproj.dll 中)
語法
'宣告
'用途
屬性值
傳回 Project 物件。
備註
使用這個屬性來擷取包含項目的 Project 物件。
範例
以下範例說明如何使用私用巨集函式擷取選定專案項目所屬專案的名稱。其中將會建立測試用的方法來使用函式。
' Macro Editor
Imports VSLangProj
Private Function GetProjectName(ByVal refs As References) _
As String
Return refs.ContainingProject.Name
End Function
Sub TestGetProjectName()
' First project is a Visual Basic or C# project.
Dim theVSProject As VSProject = _
CType(DTE.Solution.Projects.Item(1).Object, VSProject)
Dim refs As References = theVSProject.References
MsgBox(GetProjectName(refs))
End Sub