Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Loading .NET 4.0 Assemblies in LabVIEW

LabVIEW 2011 Help

Edition Date: June 2011

Part Number: 371361H-01

»View Product Info
Download Help (Windows Only)

If you want to use .NET 4.0 assemblies in LabVIEW, you must explicitly configure LabVIEW to use the Common Language Runtime (CLR) 4.0. However, consider the following caveats before installing the suggested configuration file:

  • LabVIEW does not support some .NET 4.0 features. Therefore, some .NET 4.0 assemblies might return errors in LabVIEW even if you configure LabVIEW to load them. Refer to the KnowledgeBase at ni.com for a list of unsupported .NET features in LabVIEW.
  • Assemblies that are targeted to earlier versions of the CLR might behave unexpectedly if you configure LabVIEW to load the CLR 4.0.
  • You must always use the CLR 2.0 to build a .NET interop assembly with LabVIEW.

Complete the following steps to force LabVIEW to load .NET 4.0 assemblies.

  1. Install the .NET 4.0 Framework on your development machine.
  2. Open a text editor and create a configuration file that contains the following text:

    <?xml version ="1.0"?>
    <configuration>
       <startup useLegacyV2RuntimeActivationPolicy="true">
          <supportedRuntime version="v4.0.30319"/>
       </startup>
    </configuration>
  3. Save this new configuration file in the same directory as LabVIEW.exe. Name the file LabVIEW.exe.config.
  4. Relaunch LabVIEW.


Now LabVIEW can load .NET 4.0 assemblies.
Note  If you build a stand-alone application from a LabVIEW VI or project that uses .NET 4.0 assemblies, the user of your application must install the .NET 4.0 Framework on his system and place a configuration file named application name.exe.config in the same directory as the application. The text of this configuration file must be the same as the text of the configuration file in step 2 of the previous procedure. To prevent the user from having to create his own configuration file, consider building an installer that includes the configuration file.

 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit