3

Recently I wrote a small winForm program using C# language. In the app I use C# to invoke a "*.dll" file written in C++. It works all right in my Visual Studio 2012 and on my computer, but when I move it to other computer, it always pops an error about “ Unable to load DLL ' *.dll',can not find specified module.(Exception from HRESULT: 0x8007007E). ”.

I've searched the internet for solution. There are also some similar questions regarding problems that others met and it seems that they also have not found the right solution yet. I also tried some methods like moving my '*.dll' file to windows\system32 or write the app current directory to System Enviroment Variable, but this also didn't work.

Now I really don't know how to deal with it. So I'll be very appreciative if someone could give some help.

I'm new here and thanks very much.

Shakti Prakash Singh
  • 2,414
  • 5
  • 35
  • 59
Thisis109
  • 31
  • 1
  • 2
  • 1
    You seem to be missing a dependent dll on the other computer. Check the dependency of the dll in that machine using a tool such as dependency walker: http://www.dependencywalker.com/ – Naveen Oct 03 '12 at 03:57
  • Have a look at this question with regards to the dependency suggestion above: http://stackoverflow.com/q/10774250/31770 – sduplooy Oct 03 '12 at 04:57
  • I use dependencywalker to check the dependency of the dll,and find two dll missed, then i download them and move them to windows\system32. Also I register them, but my app still can't work.. – Thisis109 Oct 03 '12 at 06:41

1 Answers1

1

Pretty old post but shows up first in Google so I am gonna post my solution to the issue: I was writing a minimal DLL in C++ which I integrated in a minimal C# console application and got the same error that you stated above. The final fix is simple: Your target PC might not have the appropriate VS redistributable package installed. In my case (VS 2013) it was this one here: http://www.microsoft.com/en-us/download/details.aspx?id=40784 for some reason it does not work to copy the required DLLs from the system32 folder manually... what a freak bug taking me half a day to find out. I did not find this anywhere online, will do some cross-posting now...

SCBuergel
  • 1,613
  • 16
  • 26