So I'm using an SDK for a hardware random number generator which provides a dll called PsyREG.dll for interacting with it, as well as some c# source for using the methods from the dll.
It has worked in the past, but somehow it has stopped working. My hands are a bit tied as I don't actually have access to the device in question at the moment, so I can't try a lot of things...
However, here's the weird thing. The dll is there, the same place it's always been. Ahd in fact File.Exists("PsyREG.dll") returns true, and I've double checked and that's the exact same way the provided c# source imports it, e.g. [DllImport("PsyREG.dll")].
Any ideas?
Perhaps you should check to see if you're expecting a specific product version of the dll, and make sure that the product versions still match up correctly.
Open DLL on the problematic system in http://www.dependencywalker.com/
I was dealing with the same exception with regards to one of my DLL's (let's call it
A
). C# was crashing because it claimed it couldn't find this DLL (A
) (while it was there in the same folder as the executable).Turned out that the issue was caused by
A
having dependency on another DLL (call itB
).B
was not in the path soA
couldn't load it when it needed it. SinceB
needed a whole bunch of other DLL's, the solution was to addB
's directory to thePATH
environment variable.It's interesting how C# crashes with the error saying that
A
is not found when in factB
was not found...I ran into this problem and solved with the following:
There's a dependency on msvcr90.dll if you compile under /MD. Try compiling the code with /MT instead.
Project properties
>C/C++
>Code Generation
>Runtime Library: /MT
It is probably this dll has some dependencies that they arent registred or arent in the same folder of your application.