0
私は現在のAppDomainの一部である必要があるDLLを持っています。 app.config/web.configのいくつかのリストからDLLを取得するようにAppDomainに通知する方法はありますか?App.ConfigからAppDomainにアセンブリをロードします。
私は現在のAppDomainの一部である必要があるDLLを持っています。 app.config/web.configのいくつかのリストからDLLを取得するようにAppDomainに通知する方法はありますか?App.ConfigからAppDomainにアセンブリをロードします。
アセンブリの名前をapp.configファイルに入力し、Assembly.Loadオプションとリフレクションを使用して実行時にアセンブリをロードすることができます。これを行う方法を説明しているMSDNの記事へのリンクがあります。あなたのプログラムで
http://msdn.microsoft.com/en-us/library/25y1ya39.aspx
基本
例:
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);
}
}