none
The Specified Module could not be found

    Question

  • I have an application developed with Visual Studio 2005 which consists of the main application EXE as a managed .NET Windows Forms application in C# and an unmanaged C DLL.

    I am calling functions in the unmanaged C dll using for example:

    [DllImport("mynative.dll")]

    public static extern short initialise();

    and in the C DLL I have

    __declspec(dllexport) short initialise();

    This all works perfectly on my development PC but when I deploy to another PC and run the application I get an exception as follows:

    Unable to load DLL 'mynative.dll" : The specified module could not be found (Exception from HRESULT: 0X8007007E)

    mynative.dll is present and stored in the same folder as the myapp.exe file and .NET 2 Framework is installed on the PC also.

    Anyone any ideas why it cant find the DLL?

    Thanks

    Steve

    Thursday, November 16, 2006 6:12 PM

Answers

  • Your DLL might depend on other DLLs to get its job done.  If you didn't copy or install those too, you'd indeed get this error message.  If you're not sure what DLLs 'mynative.dll' needs, try using DependencyWalker.  If you wrote this in C/C++, the CRT runtime DLLs are a likely source of the problem...
    Thursday, November 16, 2006 6:20 PM
    Moderator
  • Found it.

    Was a DLL for a device driver I needed. Would have been so much quicker if the exception had said what module was missing though!

    Thanks nobugz for all the help once again.

    Steve

    Friday, November 17, 2006 8:12 AM

All replies

  • Your DLL might depend on other DLLs to get its job done.  If you didn't copy or install those too, you'd indeed get this error message.  If you're not sure what DLLs 'mynative.dll' needs, try using DependencyWalker.  If you wrote this in C/C++, the CRT runtime DLLs are a likely source of the problem...
    Thursday, November 16, 2006 6:20 PM
    Moderator
  • Hi

    It does  depend on other DLL's and I have made sure there are present too. But yes It was written in C so it sounds like I do need the CRT runtime DLLs. I'll give DependencyWalker a go thanks but in the meantime what are the names of the CRT runtime DLLS?

    Thanks

    Steve

    Thursday, November 16, 2006 6:35 PM
  • Check this thread...
    Thursday, November 16, 2006 7:10 PM
    Moderator
  • Copied the files mentioned in there to the app folder and any other VC runtime files I thought might be needed. Still no joy.

    The artice also mentions vcredist.exe's in the VC SDk folder but they dont seem to be in my SDK folder.

    Why cant it tell you which module is missng in the exception?

    Friday, November 17, 2006 7:35 AM
  • Found it.

    Was a DLL for a device driver I needed. Would have been so much quicker if the exception had said what module was missing though!

    Thanks nobugz for all the help once again.

    Steve

    Friday, November 17, 2006 8:12 AM
  • I have an application developed with Visual Studio 2005 which consists of the main application EXE as a managed .NET Windows Forms application in C# and an unmanaged C DLL.

    I am calling functions in the unmanaged C dll using for example:

    [DllImport ("mynative.dll" )]

    public static extern short initialise();

    and in the C DLL I have

    __declspec (dllexport ) short initialise();

    This all works perfectly on my development PC but when I deploy to another PC and run the application I get an exception as follows:

    Unable to load DLL 'mynative.dll" : The specified module could not be found (Exception from HRESULT: 0X8007007E)

    mynative.dll is present and stored in the same folder as the myapp.exe file and .NET 2 Framework is installed on the PC also.

    Anyone any ideas why it cant find the DLL?

    Thanks

    Steve

     I have the same problem( The specified module could not be found (Exception from HRESULT: 0X8007007E) ),when I put C DLL(Adbridge_DLL.dll) in the path that include semicolon. But if I delete the semicolon in the path, Everything go well.
    Wednesday, December 30, 2009 3:24 AM
  • I have a similar problem. When I put the dll in the App_Code folder, and write:

    [DllImport("mydll.dll", EntryPoint = ?uc@adll@@YAPA_WPA_W@Z)];            //I have to use the decorated name that I get from DependencyWalker

    I get the specified module not found error. But then if I put in the exact path to the App_Code folder:

    [DllImport("C:\\Users\\Me\\...\\App_Code\\mydll.dll", EntryPoint = ?uc@adll@@YAPA_WPA_W@Z)];            //I have to use the decorated name that I get from DependencyWalker

    I can run my dll. And THEN if I change the path back to just the name of the dll, it WORKS! That is, until I close out of VS2008, and then I have to put the full path in again. Is there a system call to get the path to the App_Code folder? Or something you can specify in machine.config to check certain paths before despairing?

    Thursday, June 24, 2010 3:54 PM
  • I had the same problem, and this blog helped a lot! thanks guys.

    I also had a native C dll imported with DllImport and got that exception saying nothing about what is actually missing (having the native dll in the same folder as the .Net exe)

    It worked on my dev computer but not on the deploy one.

    To find out which dll is missing, I used a C test program :

    that uses my dll and when started it on the deploy computer you get an message stating what you are missing.

    In my case it was msvcr100.dll which I included with Microsoft Visual C++ 2010 Redistributable Package (x86)

    http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=a7b7a05e-6de6-4d3a-a423-37bf0912db84

     

    Thanks

    Philipp

    Thursday, July 15, 2010 12:12 PM