0

I have C# WPF application in which I have used C++ DLL libraries. When I build my project it builds successfully and all my DLL and exe are stored in bin/(Platform) eg(bin/Debug) folder.

Now if I copy the debug folder and paste it anywhere in my system and try to run the exe it runs successfully but if I copy the debug folder to the another system and try to run the exe it shows error "Unable to load DLL (Module could not be found HRESULT: 0x8007007E)".

Any suggestions or help will be appreciated.

I have tried setting the same Configuration and Platform for both DLL and exe. But still can't figure out that the exe is perfectly running on my system and if tried on another system its showing "Unable to load DLL" error.

  • 1
    The DLL that cannot be found does not have to be one of your DLLs. It could be a system DLL that is not present on the new computer. The C or C++ runtime libraries would be one possibility. – john Jun 20 '23 at 07:33
  • 1
    What you could do is run a dependency walker on your exe and find out exactly what DLLs are required. – john Jun 20 '23 at 07:34
  • 1
    Does this answer your question? [Unable to load DLL (Module could not be found HRESULT: 0x8007007E)](https://stackoverflow.com/questions/9003072/unable-to-load-dll-module-could-not-be-found-hresult-0x8007007e) – Klaus Gütter Jun 20 '23 at 07:43
  • @KlausGütter I have checked the question mentioned but none of the answer resolved my issue. – Ram Sharan Patel Jun 20 '23 at 09:22
  • This tool should help: [https://github.com/lucasg/Dependencies](https://github.com/lucasg/Dependencies) – drescherjm Jun 20 '23 at 13:55

1 Answers1

1

I have faced the same problem when using unmanaged c++ dll libraries in c# environment.

1.Check the compatibility of dll with 32bit or 64bit CPU.

2.Check the correct paths of DLL .bin folder, system32/sysWOW64 , or given path.

3.Check the DLL's Configuration Properties > C/C++ > Code Generation >Runtime Library, for all DLL's runtime library should be same.

This issue could arise because of platform incompatibility. You can change it from Build>Configuration manager.

In my condition some of my dll's Runtime Library was set to MDD and others to MTD, converting to same Runtime Library helped me out.