我打的异常:调试无法加载DLL'MyDll.dll':无法找到指定的模块。 (异常来自HRESULT:0x8007007E)
Unable to load DLL 'MyDll.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
由于答案Unable to load DLL (Module could not be found HRESULT: 0x8007007E)表明,我们要保持非托管的DLL在当前目录,连同所有托管的DLL(和它在那儿)。为了调试目的,我怎样才能打印将用于加载dll的当前目录?是Directory.GetCurrentDirectory()
?
Dll文件夹的搜索顺序在这里描述:http://stackoverflow.com/questions/268627/where-does-dllimport-look-for-unmanaged-dlls 你也可以显式设置搜索目录,如下所述:http ://stackoverflow.com/questions/2864673/specify-the-search-path-for-dllimport-in-net –
当前目录不是特别相关。你没有显示任何代码或给我们足够的细节。 –
@DavidHeffernan,当前目录怎么不相关?它应该是第二个地方寻找DLL ... – Grzenio