[转]The specified module could not be found. (Exception from HRESULT: 0x8007007E)

问题:
I have a managed C++ project (MyLib) that is utilizing 3'rd party C++ code and libraries. When I have set a reference to that project (MyLib) I have seen this error. When I put the 3'rd party .dll's into the current directory the error goes away and all works as expected however the Web projects still throw this error when attempting to compile. Is there something I need to do differently for the Web project?


Here is an example of what I am trying to do ...

- I have a managed C++ project (MyLib) that uses 3'rd party C++ code and unmanaged .dll's
- I have written a C# code library that uses MyLib
- When using a console application that references the C# library I receive this error until I put the unmanaged 3'rd party .dll's into the working directory (bin/debug)
- When attempting to compile a C# Web project that references the C# library I continue to get this error even after placing the 3'rd party unmanaged .dll's into the working directory (bin/debug)

Any help that you may be able to provide would be very helpful. Thanks in advance.


一解答:
If it doesn't have the full path to the DLL, Windows searches for unmanaged DLLs in this order:
1. app's startup directory
2. app's current directory
3. c:\windows\system32
4. c:\windows\system
5. c:\windows
6. path environment variable

Options 1 and 2 are not useful in the case of a web app, it runs through IIS.  Visit forums.asp.net or an IIS newsgroup at www.microsoft.com/communities for alternate deployment strategies for IIS.
原文地址:https://www.cnblogs.com/freeliver54/p/1055844.html