09-13-2022 09:50 AM
Hi,
In this document is explained how to force LabView to use a version of .NET framework by generating a config file to put in the directory of the executable:
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YIQoCAO&l=it-IT
This works for LabView (labview.exe.config) and for an executable generated by LabView (<executable name>.exe.config).
But if I need to generate a DLL?
I tried to use <dll name>.dll.config but doesn't work.
I tried to use <executable that use the dll>.exe.config but doesn't work.
Any idea?
Massimo
09-16-2022 02:24 AM
I think it is not possible to force .NET version for a dll.
MGava
09-16-2022 02:39 AM - edited 09-16-2022 02:40 AM
@MGava wrote:
I think it is not possible to force .NET version for a dll.
MGava
And that makes sense. The .Net framework is usually loaded at application start. And in nowadays world you really have to work very hard to write an application that doesn't somehow somewhere invoke a component that eventually also wants to load the .Net Framework. If you don't watch out even your standard hello world example program written in standard C will somehow through some obscure C runtime library import and instantiate .Net in the background. Changing the used framework later on may be possible with lots of hackery, but more likely it would require some kind of out of process invocation of the assembly and then some IPC mechanism to invoke it from within your original application. Kind of what (D)COM could do, but it was almost always more hassle to setup correctly than worth the time.
09-19-2022 03:51 AM
Hi Dr. Rolf ,
Why does the attached DLL generated by LabView, which uses the "NET palette" library, work well when used on PC with "NI Developer Suite 2012"?
Are there any libraries that can be distributed together with the DLL to make it work correctly, as if it were running on a PC with "NI Developer Suite 2012"?
Thanks for your answers
Best regards
Massimo
09-19-2022 04:08 AM
And how did you verify that it is the installation of the 2012 Developer Suite that makes the difference? What version did you use to create the DLL?
09-19-2022 05:15 AM
On three PCs on which I have "NI Developer Suite 2012" installed the software that uses the DLL creates using LabView ".NET Palette" works correctly. The executable software that uses the DLLs is built by "NI LabWindows CVI 2012".
On PCs where only the application created with "NI LabWindows CVI 2012" is installed everything works, excluding the part that uses the DLL created using LabView that using the "NET palettes". The other DLLs created using LabView 2012 without use the ".NET Palette" work fine.
Used:
LabVIEW 2012 Version 12.0.1f5 (32-bit)
LabWindows/CVI 2012 Version 12.0.1 (127)
09-19-2022 05:25 AM - edited 09-19-2022 05:28 AM
So let me summarize:
- You create a .Net assembly in LabVIEW 2012
- You want to use that .Net assembly in LabWindows/CVI 2012
If that is correct you are missing the LabVIEW 2012 Runtime engine
A LabVIEW executable or DLL is in fact a compiled version of the VIs with a wrapper according to the executable type you created. That wrapper is loaded and then searches for and initializes the according LabVIEW runtime. This runtime is needed to run the compiled VIs in the executable image and the wrapper simply initializes it and in the case of an assembly or DLL also exports the according wrapper interfaces for the different functions or in the case of an assembly the .Net classes.
in the LabVIEW project after building the .Net assembly, you should be able to add an Installer target too and tell it to use the created assembly product as source for the installer. In additional Installers you can select to include the correct LabVIEW runtime. That way you get an Installer that will make sure that the correct LabVIEW runtime is getting installed on every target system.
09-20-2022 02:11 AM
Your analysis seems to me very beautiful and correct
As you suggested we did (see attachment)
- The DLL with LabVIEW of the VI that using the "NET palettes"
- The installer of the DLL by LabVIEW
But after installation on PC still the DLL is not working properly
Do you have any steps to follow to make the installer correctly?
Have you tried to do a similar project?
Thanks for your answers!!
Best regards
Massimo