Export (0) Print
Expand All

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)

string RelativePath { get; }

Property Value

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

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

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

Show:
© 2014 Microsoft