Error: Unable to load DLL '.dll' : The specified module could not be found. (Exception from HRESULT: 0x8007007E) - What is this error?

13,366

Some of the reasons for this error could be:

  1. the name you are providing to the "EntryPoint" property of "DllImport" attribute is not matching with the function you are exporting from the native component.

  2. Another reason could be missing dll itself/or any of its dependencies(use dependency walker and check)

  3. Third reason could be it could be debug/release version mismatch.

Share:
13,366
user919789
Author by

user919789

Updated on June 04, 2022

Comments

  • user919789
    user919789 almost 2 years

    The Situation:

    I'm trying to run CharLS JPEG-LS Compression algorithm implementation

    There is source code in the site about where you can download a C# VS 2010 Solution. In the Solution there are, 2 C# Class Library Projects, 1 Unmanaged VC++ project and 1 C# Console App. The console App calls one of the class libraries, `using CharLS;', and that particular library references the unmanaged VC++ project. The console application works perfectly on debug mode.

    The Problem:

    But when I compiled the console app for "Release", and ran the .exe (executable file), when a particular function is called during the process, it gives me this error:

    Error: Unable to load DLL 'CharLS.dll' : The specified module could not be found. (Exception from HRESULT: 0x8007007E)

    I've also tried to create another project and reference the class library from there, but I get the same error.

    I've tried reading other solutions for this over the net but they have not helped me.

  • user919789
    user919789 over 11 years
    I've tried (re-)building countless times already. Same error sir.
  • Seph
    Seph over 11 years
    @user919789 did you try a clean and rebuild of the whole solution in combination with closing and re-opening visual studio? It usually fixes the error for me.
  • Avi Turner
    Avi Turner almost 11 years
    Kudos (and +1) for the debug/release version mismatch. I was testing a project deployment and did not bother to switch solution configuration to "Release".