Unable to load dll file - exception 0x8007007E

3

I'm working with National Instruments Measurement Studio in C#, and I've come across a bit of a problem in deploying my application to a particular computer (running Windows 7). I've tried asking on the National Instruments forums, but haven't got any solutions yet - could anyone here give me some tips?

Essentially, I have deployed this application several times on a number of computers, but in this particular case I receive an error when running the program -

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

  • I have ensured that nianlys.dll is present in C:\Program Files (x86)\National Instruments\Shared\Analysis.

  • I have ensured that libiomp5md.dll and LV110000_BLASLAPACK.dll, the files from mkl.msm (nianlys.dll has a dependency on mkl.msm), are present. nianlys.dll also has a dependency on nimetautils.msm, but I'm not sure which dlls are included in this.

  • I have ensured the program is installed by running the setup.exe as an administrator (as opposed to running the .msi that is generated, see here).

  • I have ensured the computer in question is up to date with updates to the .net framework via windows update.

  • I have tried reinstalling the program several times, sometimes with a freshly-recompiled installer.

  • I have tried adding in the 64 bit nianlys.msm into the setup project manually - this throws an error because the TargetPlatform property of the setup project is set to x86. The 32 bit version is, of course, already present in the detected dependencies.

  • Interestingly, taking a copy of nianlys.dll from C:\Program Files (x86)\National Instruments\Shared\Analysis and inserting it into the directory the program is installed in throws up a different error - in this case, the error is:

    "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"

  • Taking a copy of the 64 bit version of nianlys.dll from another computer (default location C:\Program Files\National Instruments\Shared\Analysis) and inserting it into the directory the program is installed in throws up a third type of error - "System.DllNotFoundException: Unable to load DLL 'nianlys.dll': A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)". It should be noted that this .dll was present before installing the program on the machines that the program works on, but is not present on the target computer that is throwing up problems.

  • Taking the same 64 bit nianlys.dll and inserting it into the location it was found on on another computer, C:\Program Files\National Instruments\Shared\Analysis, does not solve the original error.

  • Even more interestingly, I have tried to reproduce the error on a computer on which the program works - removing the x64 version of nianlys.dll throws up the original HRESULT: 0x80070007E error, whereas removing the x86 version causes a windows installer to appear when running the program.

  • On a computer upon which the program works with no problems, the windows task manager does not seem to indicate that the program is 32 bit (with the *32 suffix on the program name), despite the target platform being set to x86. It seems from all this that there is some issue with the nianlys.dll being used in both its x64 and x86 versions, despite the target platform only being x86.

I'm running out of ideas about what kind of thing I could try to solve this problem.

c#
.net
dll
asked on Stack Overflow Jan 27, 2014 by user2823789 • edited Dec 21, 2018 by Cœur

3 Answers

7

I suspect that even though the setup is for X86, the project itself is AnyCPU and thus runs as a 64bit process on 64bit systems and as a 32bit process on 32bit systems. As you said your DLL is in the Program Files (x86) folder I assume it is 32bit only, so you should compile your application explicitly as x86, too. It is your bullet #7 that leads me to this conclusion.

Just copying the nianlys.dll 64bit DLL doesn't seem to work as it seems to rely on other DLLs it then can't find. (bullet #8).

answered on Stack Overflow Jan 27, 2014 by Thorsten Dittmar
3

It may caused by the dependents of nianlys.dll are not found. You can diagnose this problem with the process monitor , one of the system internal tools. It can capture the loading/unloading DLL activities, so if something wrong, you can find it in the log.

Be sure to use the filter when use this tool, otherwise the log file will be huge.

answered on Stack Overflow Jan 27, 2014 by Matt
-1

Check for the process architecture. You could change it to x64 instead of x86 - the default value.

answered on Stack Overflow Apr 9, 2019 by Shantanu Mishra

User contributions licensed under CC BY-SA 3.0