0

We have .NET application which uses C++ library via [DllImport]. It works fine on many computers (thousands of customers) excepting 3 computers. All of them have Windows 10 installed (other Windows 10 platforms work fine).

The exception is:

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

This dll places in the same folder as main executable file. What already done to fix:

  • put DLL in system32 folder;

  • installed different version of vc redist;

  • run as administrator.

The result is the same.

Any ideas, guys?

Thanks in advance!

  • Are all the systems the same, 32-bit or 64-bit? – 001 Nov 19 '15 at 20:56
  • Obviously you need to ask the owners of those machines, they can give you an accurate answer. Ask them to run SysInternals' ProcMon and to send you the log file. Now you have a fact instead of a guess. – Hans Passant Nov 20 '15 at 02:13

1 Answers1

0

Don't put the DLL in the system directory. You aren't supposed to put files there. Put the DLL in the same directory as the executable.

If you do that and the system reports DllNotFoundException that means one of the DLL's dependencies could not be found. Next you need to find out what the dependencies are, and make sure that they are all met.

You can use a tool like Dependency Viewer to check the dependencies, but really the best way to do this is to go to the source. Either the documentation of the library if it is a third party library, or direct from the source code and compilation options if you have built the DLL yourself.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490