01-27-2010 05:36 AM
Hi!
I have got a DLL with a .NET class interface for using this DLL in LabView. The author of this DLL (an experienced software developer) made for me an example VI, which he put together with corresponding DLLs in a directory.
As I copied this directory to my location and started VI the LabView couldn't load constructor from the assemly with a general error " An error occurred trying to load the assemly". As I mentioned, the DLL was placed in the same directory with the VI and I pointed to it by pressing "Browse..." button by "Select. NET Constructor". I read NI knowlegde base and built a prooject, where I included the VI and the corresponding DLL. It was still impossible to load the assembly. Then I editied the "Path" in "Options", putting he directory with the DLL in the path for VI searching. Nothing happened.
Only after I copied the DLL in the directory where LabView.exe is located I could load the assembly. This way is not the most appropriate, because I don't have the administrator's right on all PCs where I work. It is not clear for me, why the LabView is not able to load the assembly from a defined directory. In any case it can display its name and version info.
I use LabView2009 (and tried the same with LabView 8.2), Microsoft .NET Frameword 3.5 and its SP1 are installed on my machive (OS Windows XP).
I add the pic of an error occurring during the loading of the assembly, will add the VI or the project if it would be necessary to find out what's wrong .
I thank you in advance for any ideas.
Natalie
Solved! Go to Solution.
01-27-2010 06:06 AM
01-27-2010 06:52 AM
Thank you for your suggestion: the solution you sent me is similar to my own - to copy the DLL into LabView.exe directory or, as your link says, to include it in GAC. Both means that one needs administrator rights, what is not a common case. LabView Hepl says, that it should work when I put the DLL in a project directory, I want to find out why it doesn't work.
01-27-2010 09:11 AM
01-27-2010 09:17 AM
The author of the DLL has written it in such a way that it is necessary to create a constructor in order to use properties and methods of 2 classes, which he put in the DLL. He told me , that all functions are public.
On the other hand, the LabView doesn't say that there are no constructors there, it says, that it is error by loading assembly :-(.
01-27-2010 09:38 AM
Load the DLL with Lutz Roeder's .net reflector and look at it's dependencies. Maybe this gives you a hint.
01-27-2010 09:46 AM
01-28-2010 01:10 AM
01-28-2010 03:26 AM
Hi, Christian!
I tried to open the DLL I talked about with "reflector" and it can't resolve it either. Does it mean, that the software developer has to do some changes ? Maybe it is a solution...
Thank you for sending me this tip
01-28-2010 04:50 AM
Is there an error when loading your dll to the reflector ? If it's on the left pane you can use the context menu to analyse or disassemble the dll.
If you have VisualStudio installed you can also try to reference the assembly in a simple project or use the VS Object Browser to have a look at it's interface.