Error Regarding policy.17.5.NationalInstruments.Common When Building or Running an Application Installer

Updated Apr 14, 2023

Reported In

Software

  • Measurement Studio

Driver

  • NI-Digital Pattern Driver
  • NI-FGEN
  • NI-RFSA
  • NI-RFSG
  • NI-RFPM
  • NI-SCOPE
  • NI-SWITCH
  • NI-TClk
  • NI-DAQmx 17.5
  • NI-DAQmx 17.6
  • NI-VISA 17.5
  • NI-488.2 17.5
  • NI-488.2 17.6
  • NI-DCPower 17.5
  • NI-DCPower 17.6.1
  • NI-DMM 17.5

Issue Details

When building an installer that includes NationalInstruments.Common.dll 17.5 using Measurement Studio or running an installer which includes the DLL, it errors out with a message about policy.17.5.NationalInstruments.Common. The specific error message will vary depending on the installer technology used.

Solution

This error only occurs when including NationalInstruments.Common.dll version 17.5 in an installer through the use of a merge module. This issue can be worked around by using an alternate deployment strategy.

The best solution is to use Measurement Studio Installer Builder  to create the installer for the application, and manually include the NationalInstruments.Common .NET Runtime Installer. These runtime installers can also be added to any installer tool that supports including .MSI files. The runtime installers can be found on disk at C:\ProgramData\National Instruments\MDF\ProductCache. Note that C:\ProgramData is hidden in Windows by default.

If the installer tool does not support adding in .MSI installers, then NationalInstruments.Common.dll and its required dependencies can be manually added to the installer project. This style of deployment is referred to as an XCOPY deployment.

Note: If you do not use Measurement Studio 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 .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

Additional Information

  • This issue is due to a bug in the merge module for NationalInstruments.Common.dll version 17.5. This DLL is used by the .NET class libraries for drivers with a 17.5 or 17.6 release. This is fixed in newer releases of the drivers.
  • Certain installer technologies will report this problem differently. Many modern installer tools will report the error at the time the installer is built. Certain installer tools, like Visual Studio 2010 Setup projects, will include the merge module and simply not deploy the associated policy files. This can cause the issue to appear when installing the application or as an assembly loading error when running the application.
  • Visual Studio 2010 Setup projects will default to using merge modules to include project dependencies and as such will be affected by this bug. 
  • National Instruments encourages the use of a deployment strategy that is not based on merge modules like Measurement Studio Installer Builder or package-based deployments through NI Package Manager. As merge modules are an older technology, NI will drop support for merge modules from Measurement Studio around the 2019 release of Measurement Studio.
  • If you are able to successfully build and run your installer, but you are seeing an error loading the assembly, this could also be the result of using the merge module