VSProject.References 属性

更新:2007 年 11 月

获取项目的 References 集合。只读。

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

语法

声明
ReadOnly Property References As References
用法
Dim instance As VSProject
Dim value As References

value = instance.References
References References { get; }
property References^ References {
    References^ get ();
}
function get References () : References

属性值

类型:VSLangProj.References

包含有 Reference 对象的 References 集合,其中每个对象都表示一个引用。

备注

为了对外部组件编写代码,您的项目必须首先包含对该组件的引用。可对三种类型的组件进行引用:.NET 程序集、COM 自动化服务器和控件,以及同一解决方案中公开组件的其他项目。

示例

' Macro Editor
' Assuming that the first project in the solution is a Visual Basic or C#
' application, this routine lists the references in the project.
Imports VSLangProj
Sub ListReferences()
   ' Retrieve the VSProject object.
   Dim theVSProject As VSProject = _
      CType(DTE.Solution.Projects.Item(1).Object, VSProject)

   ' Retrieve the references collection.
   Dim refs As References = theVSProject.References

   ' Create a string list of the reference names.
   Dim refList As String = ""
   Dim aRef As Reference
   For Each aRef In refs
      refList &= aRef.Identity & ControlChars.CrLf
   Next
   MsgBox(refList)
End Sub

权限

另请参见

参考

VSProject 接口

VSProject 成员

VSLangProj 命名空间