LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Missing dependencies when calling LabView generated .NET Interop Assembly in C# project

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.

 

 

0 Kudos
Message 1 of 4
(2,147 Views)

Have you found solution to this? 

0 Kudos
Message 2 of 4
(1,944 Views)

Hi Kenti, Unfortunately I haven't

0 Kudos
Message 3 of 4
(1,938 Views)

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

Kenti_0-1644430430188.png

 

 



0 Kudos
Message 4 of 4
(1,920 Views)