12-16-2019
04:41 PM
- last edited on
12-17-2019
01:26 AM
by
altenbach
Hi,
When attempting to connect to a GPIB device in VB.Net, an exception is thrown:
System.IO.FileLoadException: Could not load file or assembly 'NationalInstruments.Common, Version=13.0.40.168, Culture=neutral, PublicKeyToken=dc6ad606294fc298' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
This is in VB 2013, on Windows 10.
The same exception is reported on two different development PCs. On both PCs, I have loaded NI from a CD and connected a USB/GPIB adapter. I tried the same adapter on both PCs as I only have the one. From both PCs, I can communicate with the GPIB instrument using the NI-VISA Interactive Control.
Here is what I have tried:
Creating references to the NI dlls in my project, then clean and rebuild
Deleting project binary files (then clean and rebuild)
Changing the reference to NationalInstruments.Common.dll in the .vbproj file
Rebooting the PC
Searching C:\ for all locations of NationalInstruments.Common.dll. None of the dlls are 13.0.40.168 (The PC has 15.0.40.49154 which our company uses, and 8.7.35.131 a previously used version)
Checked the various GAC files for anything with 13.0.40.168
Does anyone know where this reference to 13.0.40.168 comes from? Or have any suggestion as how to resolve this?
Thanks
Solved! Go to Solution.
12-17-2019 10:16 AM
I seem to recall something about having to change the Target Framework to something without Client Profile.
12-17-2019 07:51 PM
I solved it by adding this to the primary project's app.config file:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NationalInstruments.Common" publicKeyToken="dc6ad606294fc298" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-15.0.40.49154" newVersion="15.0.40.49154" />
</dependentAssembly>
</assemblyBinding>
</runtime>