1 2 3 4 5 6 7 8 9 10 11 12 13 14
| [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern bool SetDllDirectory(string path);
var path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); path = Path.Combine(path, Environment.Is64BitProcess ? "x64" : "x86"); SetDllDirectory(path);
DirectoryInfo modulePath = new DirectoryInfo(path); DirectoryInfo[] dirSub=modulePath.GetDirectories(); foreach (DirectoryInfo directoryInfo in dirSub) { var temp = Path.Combine(path, directoryInfo.ToString()); SetDllDirectory(temp); }
|