VCAssemblyReference.RelativePath 属性

定义

获取或设置指向所选引用的路径(相对于项目目录)。

public:
 property System::String ^ RelativePath { System::String ^ get(); };
public:
 property Platform::String ^ RelativePath { Platform::String ^ get(); };
[System.Runtime.InteropServices.DispId(2025)]
public string RelativePath { [System.Runtime.InteropServices.DispId(2025)] get; }
[<System.Runtime.InteropServices.DispId(2025)>]
[<get: System.Runtime.InteropServices.DispId(2025)>]
member this.RelativePath : string
Public ReadOnly Property RelativePath As String

属性值

String

指向所选引用的相对路径。

属性

示例

此示例将引用添加到项目,然后列出其相对路径。

' Add a reference to Microsoft.VisualStudio.VCProjectEngine and have a   
' Visual C++ project loaded before running this example.  
Imports EnvDTE  
Imports Microsoft.VisualStudio.VCProjectEngine  

Public Module Module1  
    Sub Test()  
        Dim prj As VCProject  
        Dim vcar As VCAssemblyReference  

        prj = DTE.Solution.Projects.Item(1).Object  
        If prj.CanAddAssemblyReference("d:\winnt\microsoft.net _  
          \framework\v1.1.4322\envdte.dll") Then  
        vcar = prj.AddAssemblyReference("d:\winnt\microsoft.net _  
          \framework\v1.1.4322\envdte.dll")  
        End If  
        MsgBox("Assembly relative path: " & vcar.RelativePath.ToString)  
    End Sub  
End Module  

注解

有关如何编译和运行此示例的信息,请参阅 如何:编译 Visual C++ 代码模型扩展性的示例代码

适用于