HighTechTalks DotNet Forums  

Dynamically load an assembly

Dotnet Academic General Discussions microsoft.public.dotnet.academic


Discuss Dynamically load an assembly in the Dotnet Academic General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Nelson Xu
 
Posts: n/a

Default Dynamically load an assembly - 01-20-2005 , 11:33 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


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.