共用方式為


VCAssemblyReference.RelativePath Property

Definition

Gets or sets the path to the selected reference, relative to the project directory.

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

Property Value

The relative path to the selected reference.

Attributes

Examples

This example adds a reference to your project and then lists its relative path.

' 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  

Remarks

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

Applies to