Поделиться через


VCProjectReference.ReferencedProject - свойство

Gets or sets the pointer to the project for the selected project reference.

Пространство имен:  Microsoft.VisualStudio.VCProjectEngine
Сборка:  Microsoft.VisualStudio.VCProjectEngine (в Microsoft.VisualStudio.VCProjectEngine.dll)

Синтаксис

'Декларация
ReadOnly Property ReferencedProject As Object
'Применение
Dim instance As VCProjectReference
Dim value As Object

value = instance.ReferencedProject
Object ReferencedProject { get; }
property Object^ ReferencedProject {
    Object^ get ();
}
function get ReferencedProject () : Object

Значение свойства

Тип: System.Object

A pointer to the project for the selected project reference.

Заметки

A VCProject object.

Примеры

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

' Add a reference to Microsoft.VisualStudio.VCProjectEngine.
' This sample displays the name of every referenced project in a 
' Visual C++ project in the solution. Therefore, make sure you have a 
' Visual C++ 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++ project
            If Not vcproj Is Nothing Then
                ' Loop the references for this Visual C++ 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 there is 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

Разрешения

  • Полное доверие для непосредственно вызывающего метода. Этот член не может быть использован частично доверенным кодом. Дополнительные сведения см. в разделе Using Libraries from Partially Trusted Code.

См. также

Ссылки

VCProjectReference Интерфейс

VCProjectReference - члены

Microsoft.VisualStudio.VCProjectEngine - пространство имен