Dynamically load .NET assembly -
01-20-2005
, 11:34 AM
Hi All,
I try to load an .NET assembly at run time. Here is my
code:
Dim MyAssembly As [Assembly]
MyAssembly = [Assembly].LoadFrom
("file:///C:/LoadAssembly/bin/Radar.Business.Batch.dll")
Dim arrType As System.Type() = MyAssembly.GetTypes()
Dim obj As Object = System.Activator.CreateInstance(arrType
(0))
Dim boolRet As Boolean = obj.Start()
Above code works fine. However, I got error when I tried
to use
Dim obj1 As ObjectHandle = System.Activator.CreateInstance
(MyAssembly.FullName, arrType(0).FullName)
to replace
Dim obj As Object = System.Activator.CreateInstance(arrType
(0))
Here is the error message:
File or assembly name Radar.Business.Batch, or one of its
dependencies, was not found
Thank you in advance !
Nelson |