Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

VCProjectReference.Reference Property

Displays the reference associated with this configuration.

Namespace:  Microsoft.VisualStudio.VCProjectEngine
Assembly:  Microsoft.VisualStudio.VCProjectEngine (in Microsoft.VisualStudio.VCProjectEngine.dll)

Object Reference { get; }

Property Value

Type: System.Object
An object representing the reference associated with this configuration.

See How to: Compile Example Code for Project Model Extensibility for information about how to compile and run this example.

' Add a reference to Microsoft.VisualStudio.VCProjectEngine.
' This sample displays the path of each reference in a Visual C++
' project. Therefore, make sure you have a Visual C++ 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++ project
            If Not vcproj Is Nothing Then
                ' Loop each reference in the Visual C++ 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
            End If
    End Sub
End Module

© 2015 Microsoft