Export (0) Print
Expand All
Expand Minimize

Reference Property

Visual Studio .NET 2003

Displays the reference associated with this configuration.

[Visual Basic .NET]
Public ReadOnly Property Reference() As Object
[Visual Basic 6]
Property Get Reference() As Object
[C++]
HRESULT __stdcall get_Reference(
   /* [out, retval] */ IDispatch** retVal
);
[C#]
public object Reference {get;}
[JScript .NET]
public function get Reference() : Object

Return Value

An object representing the reference associated with this configuration.

Example

' Add a reference to Microsoft.VisualStudio.VCProjectEngine.
' This sample will display the path of each reference in a Visual C++ .NET 
' project. Therefore, make sure you have a Visual C++ .NET project loaded 
' before running this code.
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine

Public Module Module3
    Sub Test()
        Dim proj As Project
        Dim vcproj As VCProject
        Dim ref As VCReference
        Dim vsref As VSLangProj.Reference
        Dim refproj As Project

        On Error Resume Next

        ' Loop each project in the solution
        For Each proj In DTE.Solution.Projects
            vcproj = Nothing
            vcproj = CType(proj.Object, VCProject)
            ' If this is a Visual C++ .NET project
            If Not vcproj Is Nothing Then
                ' Loop each reference in the Visual C++ .NET project
                For Each ref In vcproj.VCReferences
                    vsref = Nothing
                    vsref = CType(ref.Reference, VSLangProj.Reference)
                    ' If we have the Visual Studio reference
                    If Not vsref Is Nothing Then
                        MsgBox("The path for reference '" & vsref.Name  _
                          & "' is '" & vsref.Path & "'.")
                    End If
                Next
            End If
        Next
    End Sub
End Module

See Samples for Project Model Extensibility for information on how to compile and run this sample.

See Also

Applies To: VCActiveXReference Object | VCAssemblyReference Object | VCProjectReference Object | VCReference Object | VCReferenceConfiguration Object

Show:
© 2014 Microsoft