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
声明
Sub RemoveReference ( _
pDispRef As Object _
)
用法
Dim instance As VCProject
Dim pDispRef As Object
instance.RemoveReference(pDispRef)
void RemoveReference(
Object pDispRef
)
void RemoveReference(
[InAttribute] Object^ pDispRef
)
function RemoveReference(
pDispRef : Object
)
Parameters
pDispRef
Type: System.ObjectThe 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
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.