Dynamicly refrence a .NET DLL

  • Thread starter Thread starter rbonin
  • Start date Start date
R

rbonin

I have seveal vb.net Dll's I created that handle several maintinance
functions. I would like to have a single windows service that runs each
of the utilities at a scheduled time. right now I have it working, but
each time I want to change the schduled run time, or turn off one of
these task, I have to recompile the main application.

Is there a way I can create an instance of an object that is not
refrenced to the main project, or dynamicly refrence these Dlls?
 
Is there a way I can create an instance of an object that is not
refrenced to the main project, or dynamicly refrence these Dlls?

If I understand what you are asking then the short answer is to use what is
called "Reflection".

Reflection allows you to "ask" the runtime about the existence and
attributes of assemblies, types, methods etc which are not known until
runtime.

Check the docs for any of the load... methods in Reflection.Assembly which
allow you to load an assembly, the GetTypes() method which allows use to
find the classes (types) that an assembly implements,
System.Type.GetMethod() which allows you to find the methods that a type
implements Activator.CreateInstance() which allows you to create an instance
of a type and MethodInfo.Invoke() which allows you run a method on a type.

Regards,
Will
 
Just create a common interface and compile the interface into a dll. In
your
application load plug ins from a "plugins" dll file that implement the
interface
and call the interface methods. I only have code in C#.

http://www.geocities.com/jeff_louie/OOP/oop13.htm

Regards,
Jeff
Is there a way I can create an instance of an object that is not
refrenced to the main project, or dynamicly refrence these Dlls?
 
Back
Top