Error 6308 File Not Found Error When Opening .NET DLL in an Executable

Updated Aug 24, 2023

Reported In

Software

  • LabVIEW Professional
  • LabVIEW Full
  • LabVIEW Application Builder Module

Issue Details

When I run a stand alone executable with a .NET DLL referenced in the program, I get a window saying it cannot find the referenced DLL:

Or I get an error: 

Error 6308 the .NET ressource System.dll could not be found

This continues to be an error, even if I point to it in the Loading Files dialog box and have already included a configuration file with LabVIEW to get everything to work in the development environment on my machine.

 

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.