次の方法で共有


VSProject.References Property

Definition

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

public:
 property VSLangProj::References ^ References { VSLangProj::References ^ get(); };
[System.Runtime.InteropServices.DispId(1)]
public VSLangProj.References References { [System.Runtime.InteropServices.DispId(1)] get; }
[<System.Runtime.InteropServices.DispId(1)>]
[<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.

Attributes

Examples

[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  
   Next  
   MsgBox(refList)  
End Sub  

Remarks

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