11-09-2012 03:51 AM
Hi,
i have an issue with using a LabVIEW interop assembly in a .NET application. I get an exception "Unable to determine the install root path for the LabVIEW Runtime Engine" when calling the assembly.
The little test program is attached below. It's called dotNETHost.exe. If you excecute the programm a dialog with an button appears. Clicking the button shall open another dialog (the LabVIEW Interop component). But the only thing I get is the exception message. The ZIP folder also contains the complete exception meassage (ExceptionMessange.jpg & ExceptionDetails.txt).
The Interop Assembly was built with LabVIEW 2011. We use Visual Studio 2010 and .NET 4.0.. The dotNETHost.exe.config file is prepared as mentioned in Knowledge base - Loading .NET 4.0 assemblies.
The Interop assembly contains only one simple dialog (loop is finished by clicking OK) without calling any other VIs or other DLL's. In case of this there's also no support directory generated by the build process.
I have no idea why it doesn' work. I hope anyone can help me.
Thanks in advance
Kay
11-09-2012 04:39 AM
This may be unrelated, but Labview and .Net4.0 dont work well together. Not yet anyway. I had to compile my assembly in 3.5 to get it to work.
Please read the following:
http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/configuring_clr_version/
http://digital.ni.com/public.nsf/allkb/32B0BA28A72AA87D8625782600737DE9
http://digital.ni.com/public.nsf/allkb/2030D78CFB2F0ADA86257718006362A3?OpenDocument
11-12-2012 08:57 AM
Hi Kay,
any success with your issue? I am experiencing the same error. I use .net 2.0, but I still get it.
I use LabVIEW 2011 and VS 2012.
I would appreciate any help with this issue.
Thanks,
Zoli
11-12-2012 09:43 AM
I have found the soulution for my problem.
The .net app was targeted at multi-cpu. It looks like that in this case LV does not know which runtime to load. I choose x86 target CPU, and magic, everything runs fine
Here a link with more informations:
http://lavag.org/topic/15593-calling-dlls-made-in-labview-2011-in-visual-c-net-40/
05-27-2020 10:47 AM
I am still having this issue in 2020.
I use visual studio 2017, compiled my program in x86.
Labview is Labview2019, runtime engine is Labview2019, both 32-bit.
The labview dll was created in the .NET framework
05-27-2020 12:08 PM
I have tried creating a LabVIEW.exe.config
<configuration>
<startup>
<requiredRuntime version="v3.5"/>
</startup>
</configuration>
with this inserted, but when I build my .NET dll in Labview and then load the reference into C#, it still appears as "runtime version v4.0.30319"
I can not seem to figure out how to force Labview to compile the .NET dll in 3.5 framework. I've tried the links, but most of them are how to get .NET to work in labview, not vice versa