実行時にロードされたアセンブリでメソッドを実行する必要があります。ロードするアセンブリは、インターフェイスの実装を含むプラグインです。
これはローディングクラスです:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
namespace Stub.Logic {
public class DllReader {
private static List<Type> connectionTypes = new List<Type>();
public static void LoadConnectionTypes(string path) {
DirectoryInfo dllDirectory = new DirectoryInfo(path);
FileInfo[] dlls = dllDirectory.GetFiles("*.dll");
foreach (FileInfo dllFileInfo in dlls) {
Assembly assembly = Assembly.Load(dllFileInfo.FullName);
connectionTypes.AddRange(assembly.GetTypes());
}
}
//public static Connection GetConnection(string connectionTypeName) {
// return new Connection();
//}
}
}
このエラーが発生します:
ファイルまたはアセンブリ'..\ Plugins\MqConnection.dll'またはその依存関係の1つを読み込めませんでした。指定されたアセンブリ名またはコードベースが無効でした。(HRESULTからの例外:0x80131047)
これはロードされたアセンブリです:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.IO;
using Stub.Logic;
namespace MqConnection {
public class MqConnection : Connection {
// Stuff here...
}
}
私は何が間違っているのですか?