Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

AddAssemblyReference Method

Visual Studio .NET 2003

Adds an assembly (.NET) reference to the selected project.

[Visual Basic .NET]
Public Function AddAssemblyReference( _
   ByVal path As String _
) As Object
[Visual Basic 6]
Function AddAssemblyReference( _
   ByVal path As String _
) As Object
[C++]
HRESULT __stdcall AddAssemblyReference(
   BSTR path,
   /* [out, retval] */ IDispatch** retVal
);
[C#]
public object AddAssemblyReference(
   string path
);
[JScript .NET]
public function AddAssemblyReference(
   path : String
) : Object

Parameters

path
A string representing the path of the assembly to add.

Return Value

The path of the assembly.

Example

Adds a .NET assembly reference to your project based on the path to the assembly, if possible.

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

Public Module Module1
    Sub Test()
        Dim prj As VCProject
        prj = DTE.Solution.Projects.Item(1).Object            
        If prj.CanAddAssemblyReference("d:\winnt\microsoft.net _
          \framework\v1.1.4322\envdte.dll") Then
           prj.AddAssemblyReference("d:\winnt\microsoft.net _
             \framework\v1.1.4322\envdte.dll")
        End If
    End Sub
End Module

See Samples for Visual C++ Code Model Extensibility for information on how to compile and run this sample.

See Also

Applies To: VCProject Object | VCReferences Collection

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.