10-19-2021 06:20 AM
I have a C# WPF project in visual studio 2019 and I'm trying to call LabVIEW VIs in it.
Currently I have a .NET assembly DLL built from a LabVIEW project loaded into my C# project and I'm able to reference the methods(vi) I want to use. However when I run my project and it tries to run the method it says the VI method is missing a dependency. This dependencies are 2 packed libraries from the for mentioned LabVIEW project. I have tried building the DLL with these packed libraries as dependencies in the project and tried putting them in the actual project files not under dependencies. Neither have worked. I have tried putting these packed libraries next to the DLL in the C# project and next to the .exe in the debug. Which both have also not worked.
The VI I'm trying to call "Method1.vi" is a very simple VI that just calls a sub VI "ModularInstruments_LoadConfig.vi" located in one of the packaged libraries.
Error code I get in visual studio:
System.TypeInitializationException: 'The type initializer for 'AsInstrumentAssembly.LvClient' threw an exception.'
FileNotFoundException: Missing Dependency in: Method1.vi: Library not found or failed to load: ModularInstruments_LoadConfig.vi
VIAssemblyException: Missing Dependency in: Method1.vi: Library not found or failed to load: ModularInstruments_LoadConfig.vi
Any suggestions or solutions would be much appreciated.
02-09-2022 06:13 AM - edited 02-09-2022 06:13 AM
Have you found solution to this?
02-09-2022 06:27 AM
Hi Kenti, Unfortunately I haven't
02-09-2022
12:25 PM
- last edited on
01-21-2025
05:48 PM
by
Content Cleaner
Hi Jack,
In my case, there was a problem with folder path length for specific lvlib. Looks like the path was too long calling instance was unable to locate VIs. After moving "problematic" lvlib that caused the exception up in hierarchy and building again. It solved problem in my case.
Previously, I tried some .exe builds and problem occurred only when the build name was too long. In this case, the error was according to this link: Error 6: Generic File I/O
After shortening the name of the build specification problem was solved.
In other cases, I called Dll from visual studio with VI pop-up window. After starting the Runtime engine the search window occurred after finding proper vi, code was running.
In other cases, the code behaved according to your description.
Preparion VIs for DLL build might also help as referenced here.
I hope this helps.
Search Window