Reputation: 13012
I have a DLL that I need to be a part of the current AppDomain. Is there a way to signal the AppDomain to pick up dlls from some list in the app.config/web.config?
Upvotes: 0
Views: 964
Reputation: 2771
You can put the name of the assembly in the app.config file and then load it up at run time using the Assembly.Load options and reflection. Here is a link to the MSDN article describing how to do this.
http://msdn.microsoft.com/en-us/library/25y1ya39.aspx
Basics
Example from the link:
public class Asmload0
{
public static void Main()
{
// Use the file name to load the assembly into the current
// application domain.
Assembly a = Assembly.Load("example");
// Get the type to use.
Type myType = a.GetType("Example");
// Get the method to call.
MethodInfo myMethod = myType.GetMethod("MethodA");
// Create an instance.
object obj = Activator.CreateInstance(myType);
// Execute the method.
myMethod.Invoke(obj, null);
}
}
Upvotes: 3