Solution
This error usually occurs because the DLL was built using .NET 4.0 Framework and LabVIEW defaults to .NET 3.5. The configuration file you have placed next to the LabVIEW.exe will not change the way that the Runtime application is executed.
Similar to changing the LabVIEW development environment, you can also force your .exe to load .NET assemblies that are targeted to the CLR 4.0. However, make sure you consider the following:
- LabVIEW does not support every feature in .NET 4.0 (e.g. Generics).
- If you load the CLR 4.0, assemblies that target earlier versions might behave unexpectedly.
- LabVIEW did not undergo any testing using assemblies targeting the CLR 4.0.
To fix the issue, you must first make sure that the user of the stand-alone application has .NET 4.0 installed on their system. You will then need to place a configuration file named
Application_Name.exe.config in the same directory as the application that contains the following text.
<?xml version ="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
</startup>
</configuration>You will need to include this configuration file as a supporting document in the final build. To do this you can add it to your project files under the
Always Included section of the build. This will put it in the same location as your .exe. This will bundle the configuration file with the deployment of the application.