共用方式為


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 組件 (Assembly)、COM Automation 伺服程式和控制項及其他在相同方案內公開元件的專案。

範例

' 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 命名空間