01-04-2012 03:41 PM
I installed VISA 5.1.1 on my windows 7 x86 machine. This is where I have visual studio 2010 installed. I am looking into writing software to control some equipment using GPIB. To start out with, I started to look at the .NET 4.0 examples. I tried to run SimpleReadWrite but it had the following error:
rite\cs\MainForm.cs(17,37): error CS0012: The type 'NationalInstruments.ISynchronizeCallbacks' is defined in an assembly that is not referenced. You must add a reference to assembly 'NationalInstruments.Common, Version=220.127.116.112, Culture=neutral, PublicKeyToken=dc6ad606294fc298'. C:\Users\Public\Documents\National Instruments\NI-VISA\Examples\DotNET4.0\SimpleReadW rite\cs\MainForm.cs(17,37): error CS0012: The type 'NationalInstruments.ISupportSynchronizationContex t' is defined in an assembly that is not referenced. You must add a reference to assembly 'NationalInstruments.Common, Version=18.104.22.1682, Culture=neutral, PublicKeyToken=dc6ad606294fc298'.
I than went to do what it said and add the NationalInstruments.Common reference but I can't find the version it says. The closest version I found is 22.214.171.124. I added that version and it works just fine on my Windows 7 machine but when I run it on my windows XP machine where my equipment is, it has the following error:
Where would I find the correct version of NationalInstruments.Common? Or how would I fix this issue?
01-05-2012 05:24 PM
From your description it looks like the issue is related to a mismatch of the NationalIntruments.Common assembly version.
You didn´t mentioned installing NI-488.2 drivers. Do you have them installed? If you don´t, I would suggest you to install the NI-488.2, any version later than 2.8.1 (3.0 is the latest version), as these versions have support for Visual Studio 2010 with .NET Framework 4.0 Languages (C# and Visual Basic.NET). You can download the driver here.
Certified LabVIEW Associate Developer (CLAD)
01-06-2012 08:18 AM
I did what you suggested and installed the NI-488.2 drivers (Version 3.0). I went and rebuilt the SimpleReadWrite project but it still had the same NationalInstrument.Common version error. I looked through the references I could add in VS2010 and I did not find NationalInstrument.Common version 126.96.36.1992. I was hoping by installing the NI-488.2 drivers that it would install the missing version.
I did find a way around the issue yesterday. I created a app.config file to remap the missing version to the version I had and it seems to run now, I need to test it more. This is what I added:
<configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="NationalInstruments.Common" publicKeyToken="dc6ad606294fc298" culture="neutral" /> <bindingRedirect oldVersion="188.8.131.522" newVersion="184.108.40.206"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration>
Is there a better way to fix this issue? Or should I just go with the app.config workaround?
01-12-2012 02:25 PM
When you installed the NI-488.2 drivers, did you choose to install the .NET support? I ran the install of the NI-488.2 3.0 in my computer as a test and noticed that you need to explicitly select to install .NET Framework 4.0 Languages Support. May may want to try this to see if you get a different result.
01-18-2012 09:25 AM - edited 01-18-2012 09:26 AM
I double checked, but I did install the .NET Framework 4.0 Language Support. To make sure it installed correctly, I did a repair on the NI-488.2 3.0 installation but still no luck. See Screenshot for installed components.
Any other suggestions?
01-27-2012 12:08 PM
I think this problem was solved in another post before, and the solution is explained in the following quote:
"When you create a project in VS Express, by default the target framework is set to ".NET Framework 4 Client Profile." This article from Microsoft explains what this means: http://msdn.microsoft.com/en-us/library/cc656912.a
I would suggest you to try this.
02-06-2012 02:32 AM
I am having an identical problem. Installed the latest (as of Febuary 1st) NI-GPIB drivers, 3.0. Chose the .NET 4 support at installation. Started up the SimpleReadWrite solution in C# Express 2010 and when I compile I receive the following the errors
Error 1 The type 'NationalInstruments.ISupportSynchronizationContex
Error 2 The type 'NationalInstruments.ISynchronizeCallbacks' is defined in an assembly that is not referenced. You must add a reference to assembly 'NationalInstruments.Common, Version=220.127.116.112, Culture=neutral, PublicKeyToken=dc6ad606294fc298'. C:\Users\Public\Documents\National Instruments\NI-488.2\Examples\DotNET4.0\SimpleRead
The build target is already .NET 4.0 and when I go to add a reference to the above assembly, I only see version 18.104.22.168 and 22.214.171.124. I can add either, but get the same error.
02-06-2012 02:43 AM
The assembly binding redirect trick with the app.config does not work either.
Note : I'm using Windows 7, not Windows XP like the original poster.
02-06-2012 03:13 AM
Ok, I got it to work with an assembly NationalInstruments.Common 126.96.36.199.... It did not work with 188.8.131.52, or 184.108.40.206. All 3 are listed, although 220.127.116.11 and 18.104.22.168 are listed first, and together.