VSProject.References Property


Gets the References collection for the project. Read-only.

 property VSLangProj::References ^ References { VSLangProj::References ^ get(); };
public VSLangProj.References References { [System.Runtime.InteropServices.DispId(1)] get; }
[<get: System.Runtime.InteropServices.DispId(1)>]
member this.References : VSLangProj.References
Public ReadOnly Property References As References

Property Value

A References collection containing Reference objects, each one representing a reference.



[Visual Basic]

' 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  
End Sub  


In order to write code against an external component, your project must first contain a reference to that component. A reference can be made to three types of components: .NET assemblies, COM automation servers and controls, and other projects within the same solution that expose components.

Applies to