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


VCAssemblyReference.RelativePath Property

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

Namespace:  Microsoft.VisualStudio.VCProjectEngine
Assembly:  Microsoft.VisualStudio.VCProjectEngine (in Microsoft.VisualStudio.VCProjectEngine.dll)

Syntax

'Declaration
ReadOnly Property RelativePath As String
    Get
string RelativePath { get; }
property String^ RelativePath {
    String^ get ();
}
abstract RelativePath : string
function get RelativePath () : String

Property Value

Type: System.String
The relative path to the selected reference.

Remarks

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

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

.NET Framework Security

See Also

Reference

VCAssemblyReference Interface

Microsoft.VisualStudio.VCProjectEngine Namespace