VCProjectReference.ReferencedProject 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置指向选定项目引用的项目的指针。
public:
property System::Object ^ ReferencedProject { System::Object ^ get(); };
public:
property Platform::Object ^ ReferencedProject { Platform::Object ^ get(); };
[System.Runtime.InteropServices.DispId(2040)]
public object ReferencedProject { [System.Runtime.InteropServices.DispId(2040)] get; }
[<System.Runtime.InteropServices.DispId(2040)>]
[<get: System.Runtime.InteropServices.DispId(2040)>]
member this.ReferencedProject : obj
Public ReadOnly Property ReferencedProject As Object
属性值
指向选定项目引用的项目的指针。
- 属性
示例
有关如何编译和运行此示例的信息,请参阅 如何:编译 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
注解
VCProject 对象。