Reference a .NET DLL That Is Not in the GAC or the LabVIEW Application Directory

Updated May 12, 2022

Reported In

Software

  • LabVIEW

Programming Language

  • C# .NET
  • Visual Basic .NET

Issue Details

I have a LabVIEW application that uses several .NET assemblies which are in different locations on the computer. I want to reference those DLLs without having to install them into the GAC or placing a copy in the same folder as the LabVIEW project or built application. Is it possible to reference a .NET assembly that does not meet with the previously mentioned characteristics?

Solution

In order to reference a DLL that is not in the same directory as the LabVIEW application, you need to create a .NET configuration file to point to the 3rd party DLLs. 

Follow these steps:
  1. Create a config file for your LabVIEW project or application which must reside in the same directory as the application it configures. The following link has information on how to specify the location of the .NET DLL that you want to reference: Specifying an Assembly's Location. One requirement is that the 3rd party DLL must be strongly named.
  2. When you create a LabVIEW executable the referenced DLLs will be placed in the "data" in the output directory by default. If you want to test that the application is referencing the correct DLL at the referenced path in the configuration file, delete the DLL from the output "data" folder.

Additional Information

You can get the publicKeyToken and culture specified in the config file by running the following command in PowerShell:

[System.Reflection.AssemblyName]::GetAssemblyName('<path to assembly>').FullName