VCProject.RemoveReference Method (Object)


Removes the specified reference from the project or references collection.

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

void RemoveReference(
	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
Return to top