Version Conflict with NationalInstruments.Common.Native DLL using Different Drivers

Updated Feb 11, 2020

Reported In

Software

  • LabVIEW

Driver

  • NI-DAQmx
  • NI-VISA
  • NI-488.2

Issue Details

I am using National Instrument's .NET library for my application. I have a working application using the NI VISA/488.2 driver, now I bought a new data acquisition card that uses the NI DAQmx driver. I've downloaded the DAQmx driver, but now during compilation in Visual Basic I get multiple warnings such as: 
 
  • No way to resolve conflict between "NationalInstruments.Common.Native, Version=9.1.40.159, Culture=neutral, PublicKeyToken=dc6ad606294fc298" and "NationalInstruments.Common.Native, Version=9.0.40.362, Culture=neutral, PublicKeyToken=dc6ad606294fc298". Choosing "NationalInstruments.Common.Native, Version=9.1.40.159, Culture=neutral, PublicKeyToken=dc6ad606294fc298" arbitrarily.
  • No way to resolve conflict between "NationalInstruments.NiLmClientDLL, Version=9.1.40.159, Culture=neutral, PublicKeyToken=dc6ad606294fc298" and "NationalInstruments.NiLmClientDLL, Version=9.0.40.362, Culture=neutral, PublicKeyToken=dc6ad606294fc298". Choosing "NationalInstruments.NiLmClientDLL, Version=9.1.40.159, Culture=neutral, PublicKeyToken=dc6ad606294fc298" arbitrarily.
  • Consider app.config remapping of assembly "NationalInstruments.Common.Native, Culture=neutral, PublicKeyToken=dc6ad606294fc298" from Version "9.0.40.362" [] to Version "9.1.40.159" [C:\Program Files\NationalInstruments\MeasurementStudioVS2010\DotNET\Assemblies\Current\NationalInstruments.Common.Native.dll] to solve conflict and get rid of warning.
  • Consider app.config remapping of assembly "NationalInstruments.NiLmClientDLL, Culture=neutral, PublicKeyToken=dc6ad606294fc298" from Version "9.0.40.362" [C:\Windows\Microsoft.Net\assembly\GAC_MSIL\NationalInstruments.NiLmClientDLL\v4.0_9.0.40.362__dc6ad606294fc298\NationalInstruments.NiLmClientDLL.dll] to Version "9.1.40.159" [C:\Program Files\NationalInstruments\MeasurementStudioVS2010\DotNET\Assemblies\Current\NationalInstruments.NiLmClientDLL.dll] to solve conflict and get rid of warning.
  • Consider app.config remapping of assembly "NationalInstruments.Common, Culture=neutral, PublicKeyToken=dc6ad606294fc298" from Version "9.0.40.362" [C:\Windows\Microsoft.Net\assembly\GAC_MSIL\NationalInstruments.Common\v4.0_9.0.40.362__dc6ad606294fc298\NationalInstruments.Common.dll] to Version "9.1.40.159" [C:\Program Files\National Instruments\MeasurementStudioVS2010\DotNET\Assemblies\Current\NationalInstruments.Common.dll] to solve conflict and get rid of warning.
  • c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3247: Found conflicts between different versions of the same dependent assembly.

Solution

What is happening is that you have a higher version of NationalInstruments.Common.dll on your system than some of your application's dependencies such at VisaNS were built against it.

NationalInstruments.Common.dll is forward compatible, so your application will run just fine with a higher version of Common. In this case, you can build your application using the higher version of Common and everything will run ok because it is forward compatible.

  • The reason it was designed this way is because Common is a component of all National Instruments .NET libraries. It contains some common functionality that is universal to all of our libraries. However, each library is built against a particular version of Common. In many cases this leads to a scenario where you may be using two libraries, such as VisaNS and DAQmx, that are built against different versions of Common.

The app.config file actually is the correct solution. What the app.config file is saying is for you application to run using the higher version. It is stating that any dependencies that require Common version 9.0.40.362 should use 9.1.40.159 instead.

  • You need this because you are building your application against this version since some other component require this higher version (in some cases this may also be because this is the version installed on your development system but none of your dependencies require it). That way when you run the application, the dependencies will look for the 9.1.40.159 version rather than the 9.0.40.362 version (your application can only load one version of an assembly). This is important when running on systems that may have many versions.

 

 

Additional Information


NOTE: If you double-click the warning in Visual Studio for the app.config file, it will automatically generate the app.config file for you.