LabView calls the C # mixed-mode dll,
Under some specific requirements, our C # program may need to make a dll for LabView to call, and we cannot ensure that the C # program is completely written by ourselves without calling a third-party dll library. In many cases, we need to use Sqlite. net, AForge. net and other open-source libraries. At this time, we find that we need to use the hybrid mode to be compatible with these libraries.. NET 2.0 is an open-source library developed during runtime.
I. hybrid mode in C #
If it is a C # application, we only need to add the "Application configuration file" in the corresponding project of the project, that is, the app. config file:
<? Xml version = "1.0" encoding = "UTF-8"?> <Configuration> <startup useLegacyV2RuntimeActivationPolicy = "true"> <supportedRuntime version = "v4.0"/> </startup> </configuration>
Then we will see the corresponding configuration file in the compiled executable file. Its name is similar to the final generated executable file:
<? Xml version = "1.0" encoding = "UTF-8"?> <Configuration> <startup useLegacyV2RuntimeActivationPolicy = "true"> <supportedRuntime version = "v4.0"/> </startup> </configuration>
4. Place all the Assembly called by LabView in the root directory (this operation prevents some assembly from failing to find the other Assembly it references)
5. Run the executable file generated by LabView
For more information, see the NI Official Website: Loading. NET 2.0, 3.0, and 3.5 Assemblies in LabVIEW.
PS: of course, this method also has a problem, that is, it cannot be directly debugged.
Hope to help you! I also hope that you can give me some advice if you have a better method!