How LabVIEW Locates .NET Assemblies

Updated Sep 20, 2023

Reported In

Software

  • LabVIEW

Issue Details

  • Where should I place my .NET assemblies (DLLs) so LabVIEW can locate them?
  • I am trying to separate my software from the C# libraries it uses so they can be uploaded separately.  Where can I put the C# libraries (.NET assemblies) so that the built LabVIEW program can still find them?

Solution

.NET requires that all assemblies either live in the Global Assembly Cache (GAC) or in the same directory or sub-directory of the application that's using those assemblies.

LabVIEW 8.0 and later meet these requirements by looking for .NET assemblies in the following locations:
  • Global Assembly Cache (GAC) - LabVIEW can access all assemblies in the GAC.
  • Specified subdirectories - If the VI is part of a LabVIEW project, LabVIEW searches the directory that contains the project and all subdirectories of that project. If the VI is not part of a LabVIEW project, LabVIEW searches the LabVIEW.exe directory. If you are using .NET assemblies in a shared library or stand-alone application, LabVIEW searches the directory that contains the library or application and the data and bin subdirectories.
  • Relative path - LabVIEW stores the relative path to the .NET assembly inside the VI (for non-GAC assemblies) and thus LabVIEW uses this path to search as well. You can create a configuration file that resides in the same directory as the application it configures to reference .NET assemblies that are not in the GAC or in the LabVIEW application directory. For further details about this alternative take a look at this article.

LabVIEW 7.x met these requirements by looking for .NET assemblies in the following locations:
  • Root directory of the top-level VI
  • Global Assembly Cache (GAC)

Note: National Instruments strongly recommends that you always put VIs that use .NET assemblies in a LabVIEW project and not leave them as stand-alone VIs.

For more information about using LabVIEW with .NET, refer to the Using .NET with LabVIEW help topic in the LabVIEW Help.