Share via


VCProject.RemoveReference Method

Removes the specified reference from the project or references collection.

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

Syntax

'Declaration
Sub RemoveReference ( _
    pDispRef As Object _
)
void RemoveReference(
    Object pDispRef
)
void RemoveReference(
    [InAttribute] Object^ pDispRef
)
abstract RemoveReference : 
        pDispRef:Object -> unit 
function RemoveReference(
    pDispRef : Object
)

Parameters

  • pDispRef
    Type: System.Object
    The reference to remove from the project or the references collection.

Examples

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

RemoveReference adds a .NET assembly reference to your project based on the path to the assembly, if possible, and then removes it.

Imports EnvDTE
Imports System.Diagnostics
Imports Microsoft.VisualStudio.VCProjectEngine

Public Module Module1
    Sub Test()
        Dim prj As VCProject
        Dim ref As VCReference
        prj = DTE.Solution.Projects.Item(1).Object
        If prj.CanAddAssemblyReference("d:\winnt\microsoft.net _
          \framework\v1.1.4322\envdte.dll") Then
            ref = prj.AddAssemblyReference("d:\winnt\microsoft.net _
              \framework\v1.1.4322\envdte.dll")
        End If
        MsgBox("Reference was added. Now removing the reference.")
        prj.RemoveReference(ref)
    End Sub
End Module

.NET Framework Security

See Also

Reference

VCProject Interface

Microsoft.VisualStudio.VCProjectEngine Namespace