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)


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


  • pDispRef
    Type: System.Object

    The reference to remove from the project or the references collection.


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\ _
          \framework\v1.1.4322\envdte.dll") Then
            ref = prj.AddAssemblyReference("d:\winnt\ _
        End If
        MsgBox("Reference was added. Now removing the reference.")
    End Sub
End Module

.NET Framework Security

See Also


VCProject Interface

Microsoft.VisualStudio.VCProjectEngine Namespace