Loading referenced dlls

 
 
 
Posted by:havardsc
Data created:23 February 2014

Hi,

 

Im trying to load a dll that references a c++/CLI-dll. In VS all is working fine and I run a test program where everything checks out. When I try to load my dll in Lab it says it cant find the c++/CLI-dll. I copied it to the bin folder where the other dll is, but it is still not working.

This is the exception being thrown:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'FastLSM, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
at HavardscLaboratorium.FastLSM.Wrapper..ctor()

This messages pops up in the listener when I try to use my dll:

Coden: WARNING: Unable to resolve assembly 'FastLSM, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'

FastLSM is the c++/CLI-dll

 

Any ideas of what Im doing wrong?

 

Håvard

It seems like your FastLSM assembly could be depending on another assembly which you did not put into the bin directory. Can you check its references in VS and make sure that all non-system reference dlls are also copied into /bin?

As a hint, this referenced assembly is being used somehow in the FastLSM.Wrapper constructor.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

The only thing called in the constructor is a managed class from FastLSM wrapping some functions. To get it working in VS I only copied the FastLSM.dll into the c# project, nothing else. Im not that good with c++, but I could not find any external stuff referenced. This is what dependecywalker found (i dont know if that is a valid way to check for external references though):

http://imgur.com/t0SKKLM

and this is the property page of the c++-project:

http://imgur.com/oowm9Jd

is there any other way of checking for dependencies?

But Im sure you are right and I will take a closer look tomorrow. Thanks for the help!