Executable Runtime Exception Loading NationalInstruments.Common Assembly

Updated Apr 20, 2023

Reported In


  • Measurement Studio

Programming Language

  • C# .NET
  • Visual Basic .NET

Issue Details

I have built an installer for my Measurement Studio .NET application. The installer runs successfully, but some computers throw an unhandled exception when I run the application. The message is similar to the following: 

Could not load file or assembly 'NationalInstruments.Common'

It also points to a specific version of the NationalInstruments.Common DLL that it is looking for. I built my installer using the National Instruments Common 17.5 Merge Module. Why did the correct Common assembly not get installed by the Merge Module?


If your installer was built using Merge Modules, your application utilizes NationalInstruments.Common, and your computer has the National Instruments Common 17.5 assembly on it, there is a known issue with the use of merge modules for application deployment. This behavior can present itself due to the correct policy files not being installed on the system (for more information, see Additional Information).

The best way to avoid this issue will be to use Measurement Studio Installer Builder to include the NationalInstruments.Common .NET Runtime Installer. If your installer tool does not support adding .MSI installers, then you can include the Common DLL and the dependencies manually through XCOPY deployment. For more detailed information on changing your installer to use the Runtime Installer, see this KnowledgeBase article.

Note: If you do not use the National Instruments Installer Builder and would like to use the NationalInstruments.Common .NET Runtime Installer, ensure you add the command-line flag INSTALLLEVEL. You must explicitly set the INSTALLLEVEL flag to 1000 when running the NationalInstruments.Common 17.5 .NET Runtime Installer standalone or through another installer method. For example, the command to run the Runtime Installer (.NET 4.0) from the command-line is the following: 

MStudioCommonRuntime.v400.msi INSTALLLEVEL=1000


This is not the only cause of this error, as this error can also result when you have not included any way to install the National Instruments Common assembly. If you are not sure how to create an installer to ensure that your Measurement Studio application has all of the correct dependencies, see the help for deploying Measurement Studio applications.


Additional Information

Versioning and deployment of the NationalInstruments.Common .NET class library works differently than versioning of other Measurement Studio class libraries, and installation of the library should install the NationalInstruments.Common class library to the GAC along with a policy file that redirects all references to NationalInstruments.Common to the latest version of NationalInstruments.Common installed on the system.