Export (0) Print
Expand All
Expand Minimize

ReferencedProject Property

Visual Studio .NET 2003

Sets or returns the pointer to the project for the selected project reference.

[Visual Basic .NET]
Public Property ReferencedProject() As Object
[Visual Basic 6]
Property Get ReferencedProject() As Object
Property Let ReferencedProject( _
   ByVal NewValue As Object _
) 
[C++]
HRESULT __stdcall get_ReferencedProject(
   /* [out, retval] */ IDispatch** retVal
);
HRESULT __stdcall put_ReferencedProject(
   /* [in] */ IDispatch* NewValue
);
[C#]
public object ReferencedProject {get; set;}
[JScript .NET]
public function get ReferencedProject() : Object
public function set ReferencedProject(
   NewValue : Object
)

Parameters

NewValue
A object pointer to the project for the selected project reference.

Return Value

A pointer to the project for the selected project reference.

Remarks

Returns the VCProject Object.

Example

' Add a reference to Microsoft.VisualStudio.VCProjectEngine.
' This sample displays the name of every referenced project in a 
' Visual C++ .NET project in the solution. Therefore, make sure you have a 
' Visual C++ .NET project loaded before running this code.
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine

Public Module Module1
    Sub Test()
        Dim proj As Project
        Dim vcproj As VCProject
        Dim ref As VCReference
        Dim projref As VCProjectReference
        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 project is a Visual C++ .NET project
            If Not vcproj Is Nothing Then
                ' Loop the references for this Visual C++ .NET project
                For Each ref In vcproj.VCReferences
                    projref = Nothing
                    projref = CType(ref, VCProjectReference)
                    ' If this reference is a project reference
                    If Not projref Is Nothing Then
                        refproj = Nothing
                        refproj = CType(projref.ReferencedProject, _
                          Project)
                        ' If we do have a referenced project
                        If Not refproj Is Nothing Then
                            MsgBox("Project named '" & refproj.Name & "' _
                              is referenced in project '" & vcproj.Name _
                              & "'.")
                        End If
                    End If
                Next
            End If
        Next
    End Sub
End Module

See Samples for Visual C++ Code Model Extensibility for information on how to compile and run this sample.

See Also

Applies To: VCProjectReference Object

Show:
© 2014 Microsoft