When loading a managed C++ assembly, you may receive the following exception:
System.IO.FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Bool
ean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, EvidencesecurityEvidence, Byte hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean
forIntrospection, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
0x8007007E is a Win32 error ERROR_MOD_NOT_FOUND.
// MessageId: ERROR_MOD_NOT_FOUND
// The specified module could not be found.
#define ERROR_MOD_NOT_FOUND 126L
The error is returned by LoadLibrary. Usually it is because one of the assembly’s native dependencies(static imports) cannot be found by the OS.
If the assembly is built as debug by Visual Studio 2005 toolset, make sure the debug version of VC80 CRT runtime is installed on the target machine before load the assembly.
To diagnose the problem, run the platform SDK tool depends.exe on the assembly to find out which native dependencies are missing.