Procedure Imported by 'NationalInstruments.DAQmx.dll' Could Not Be Loaded

Updated Dec 16, 2022

Reported In

Driver

  • NI-DAQmx

Other

  • .NET Framework
  • Microsoft Visual Studio

Issue Details

I recently installed or updated DAQmx and I'm getting errors in my project in Visual Studio. When looking deeper into the error, it says my code requires the .NET 4.0 Framework even when I have .NET 4.5 installed, which is backwards compatible.

I am getting an error similar to the following:

{"A procedure imported by 'NationalInstruments.DAQmx.dll' could not be loaded.":"NationalInstruments.DAQmx.dll"}
System.IO.FileLoadException was unhandled
HResult=-2147024769
Message=A procedure imported by 'NationalInstruments.DAQmx.dll' could not be loaded.
Source=PulseTIG
FileName=NationalInstruments.DAQmx.dll
FusionLog=""
StackTrace:
at DaqApplication1.My.MyApplication.OnCreateMainForm()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at DaqApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
InnerException:

Solution

During a standard installation, the NI-DAQmx driver will detect Application Development Environments (ADE) installed on the computer and installs the support for each accordingly. NI-DAQmx can provide ADE support for the following ADEs:
  • LabVIEW
  • LabWindows/CVI (ANSI C)
  • Microsoft Visual Studio with NI Measurement Studio (.NET)
If the recommended order of installation (1. ADE 2. NI-DAQmx driver) was not followed, the NI-DAQmx driver may not have installed the .NET components.

To add the .NET components, you will need to modify your installation. If you are installing NI-DAQmx for the first time, skip to step 3.
  1. From the Control Panel in Windows, go to Programs and Features.
  2. In the next window, double-click NI Software to open the National Instruments Add/Remove Software window.  Select your NI-DAQmx ADE Support installation in the Products tab, and click the Modify button to launch the NI-DAQmx installer. If you are using software from 2017 or newer, these steps may launch NI Package Manager instead of the NI Uninstaller. In that case, it may be easier to uninstall and then reinstall the driver.


  1. Choose Custom as the installation option.
  1. In the NI-DAQmx installer, expand Application Development Support under NI-DAQmx.
  1. Under Application Development Support, expand the .NET Framework that corresponds to your version of Visual Studio. Select the option to Install Locally.
  1. If you are upgrading to a new version of Visual Studio, make sure the .NET Framework is installed on your computer.  You can determine which framework you have and download the version you need by visiting How to: Determine which .NET Framework versions are installed | Microsoft Docs on the Microsoft website.
 
 
.NET Framework and Visual Studio Versions
Visual Studio Version.NET Framework Version
20154.6
20134.5.1
20124.5
20104.0
 
  1. Select to install the Examples for your .NET Framework. Selecting the .NET Framework Languages Support option in the installer tree will install the underlying .NET assemblies along with examples and documentation. The Measurement Studio Integration for Visual Studio option requires Measurement Studio to be installed. If you do not have Measurement Studio, remove this feature and you will still have access to the .NET assemblies, examples, and documentation.


  1. Select Next and follow the steps to complete the installation. A reboot will be required.

Additional Information

Please refer to NI-DAQmx, NI-VISA, and NI-488.2 .NET Example Locations for the location of the .NET examples in your file system.

You do not have to have Measurement Studio installed to use the .NET API for NI-DAQmx in Visual Studio. But be aware that in some cases, the NI-DAQmx DLL can be stored in a folder named after Measurement Studio even if you don't have Measurement Studio installed.