動的に別のDLLをロードするときのメモ。
System.Reflection.Assembly.GetExecutingAssembly().CodeBase で自身のパスが取れる。
file:\ が先頭に付くときがあるため取り除いている。
string selfDirPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase); if (selfDirPath.StartsWith("file:\\")) { selfDirPath = selfDirPath.Substring(6); } System.Reflection.Assembly.LoadFile(System.IO.Path.Combine(selfDirPath, "Another.dll"));