Compartilhar via


VCProject.RemoveReference(Object) Method

Definition

Removes the specified reference from the project or references collection.

public:
 void RemoveReference(System::Object ^ pDispRef);
public:
 void RemoveReference(Platform::Object ^ pDispRef);
void RemoveReference(winrt::Windows::Foundation::IInspectable const & pDispRef);
[System.Runtime.InteropServices.DispId(847)]
public void RemoveReference (object pDispRef);
[<System.Runtime.InteropServices.DispId(847)>]
abstract member RemoveReference : obj -> unit
Public Sub RemoveReference (pDispRef As Object)

Parameters

pDispRef
Object

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

Attributes

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  

Applies to