05-08-2017 12:54 PM
LabVIEW 2015 64-bit
I am trying to use a .NET interop assembly that I built in LabVIEW in a C# program using Visual Studio. I added references in the Visual Studio project to the NationalInstruments.LabVIEW.Interop.dll (from the LabVIEW Run-Time directory) and to my built DLL. The C# program runs fine on my development computer that has LabVIEW Development installed. However, when I try to run the same C# code in the same project on another computer that does not have LabVIEW Development installed, I get an exception:
System.TypeInitializationException: The type initializer for 'the .NET interop assembly namespace' threw an exception.---> System.IO.FileNotFoundException: Missing Dependency in: path to the Main VI from my project build: Library not found or failed to load: lvinput.dll
The lvinput.dll is in the data folder of the built .NET interop assembly. I have also installed LabVIEW Runtime of the same version that I built with on the other computer.
I am not sure if the lvinput.dll is not being found or if the lvinput.dll is perhaps not finding a file that it needs.
Any ideas would be appreciated.
Thanks!
Ryan
05-08-2017 02:03 PM
I have not made an interop assembly before but what happens if you move the lvinput.dll up one directory out of the data folder? I doubt that it will automatically look in that folder unless you tell it to specifically look there.
05-08-2017 02:33 PM
Thanks for the reply. I tried moving the lvinput.dll up one directory out of the data folder, and still had the same problem.
05-09-2017 04:35 AM
Will this link help?
Mathan
05-17-2017 12:49 PM
Thanks, Mathan. I took a look at the info from your link and think that the Dependency Walker could be helpful.
To update from where I was originally at:
I've been able to move the Visual Basic Solution and all of its contents (project, etc) up a few levels from its directory location on disk. When I do that, the debug executable runs fine without any dependency issues. I can also move just the bin folder which works fine as well. Could there be a path length limitation for finding a reference, or maybe a DLL that my reference references? I have also seen exception messages that call out a class from my LabVIEW code as a missing dependency. It's not always the same class either, and they are classes that I created in LabVIEW. This doesn't make sense to me at all.
I went back to trying to run the debug exe on my colleague's computer after moving the solution and its contents to a very shallow directory on disk. I still get the same exception as my original post that calls out the lvinput.dll.
I'm not sure how the .NET interop assembly that I create with LabVIEW knows how to find the lvinput.dll. It gets put into a data folder with my built interop assembly from LabVIEW, but it doesn't get included in the bin folder when I build the debug exe in Visual Studio. Is it still trying to go to the directory that I referenced the interop assembly from? I'm having a hard time figuring out what could be happening.
Thanks!
Ryan
05-17-2017 03:16 PM
One other thing of note: I can delete every copy of the lvinput.dll on my computer, yet still build and run the exe without issue for the project that is in the more shallow directory location on disk.
- Ryan