共用方式為


VCProjectReference.ReferencedProject 屬性

取得或設定所選取專案參考的專案指標。

命名空間:  Microsoft.VisualStudio.VCProjectEngine
組件:  Microsoft.VisualStudio.VCProjectEngine (在 Microsoft.VisualStudio.VCProjectEngine.dll 中)

語法

'宣告
ReadOnly Property ReferencedProject As Object
Object ReferencedProject { get; }
property Object^ ReferencedProject {
    Object^ get ();
}
abstract ReferencedProject : Object with get
function get ReferencedProject () : Object

屬性值

類型:Object
所選專案參考之專案的指標。

備註

VCProject 物件。

範例

如需如何編譯及執行範例的詳細資訊,請參閱 如何:編譯 Visual C++ 程式碼模型擴充性的範例程式碼

' 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

.NET Framework 安全性

請參閱

參考

VCProjectReference 介面

Microsoft.VisualStudio.VCProjectEngine 命名空間