12-06-2011 09:05 PM
On a Vista 32 bit PC, with vb.net 2008 express, I was able to do below with 488.2 version 8.9.35.104 and .common.dll 9.1.35.159 (and also .common.native.dll 9.1.35.159, although I am not sure if this does anything). I did get a warning of
Warning 1 Found conflicts between different versions of the same dependent assembly. G8
Imports NationalInstruments.NI4882
Public Class Form1
Dim G10 As Device
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
G10 = New Device(0, 4)
End Sub
End Class
I saved this project, then opened it from vb2010express. It converted to vb2010 project and ran well. Just to be sure, I checked that 488.2 version is still 8.9.35.104 and .common is still 9.1.35.159. I also got the same warning as in vb2008.
However, if I start with a blank vb2010 project and did the same thing as in VB2008 directly with the same 488.2 and .common version, the same code does not compile. I got these errors (G10 is the project name now):
Warning 1 The referenced assembly "NationalInstruments.Common, Version=9.1.35.159, Culture=neutral, PublicKeyToken=18cbae0f9955702a, processorArchitecture=MSIL" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project. G10
Error 2 Reference required to assembly 'NationalInstruments.Common, Version=8.7.35.131, Culture=neutral, PublicKeyToken=18cbae0f9955702a' containing the implemented interface 'NationalInstruments.ISynchronizeCallbacks'. Add one to your project. C:\Users\eyynlle\AppData\Local\Temporary Projects\G10\Form1.vb 3 16 G10
Error 3 Reference required to assembly 'NationalInstruments.Common, Version=8.7.35.131, Culture=neutral, PublicKeyToken=18cbae0f9955702a' containing the implemented interface 'NationalInstruments.ISynchronizeCallbacks'. Add one to your project. C:\Users\eyynlle\AppData\Local\Temporary Projects\G10\Form1.vb 6 19 G10
Why does it behave like this? I am running 488.2 release 2.8
======================
Similarly, on an XP prof PC, with the latest 488.2 (release 3.0), I created the same program, but with 488.2 ver 9.0.40.157 and .common 9.1.40.159, I can't compile it either with errors:
Warning 1 The referenced assembly "NationalInstruments.Common, Version=9.1.40.159, Culture=neutral, PublicKeyToken=dc6ad606294fc298, processorArchitecture=MSIL" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project. G
Error 2 Reference required to assembly 'NationalInstruments.Common, Version=9.0.40.362, Culture=neutral, PublicKeyToken=dc6ad606294fc298' containing the implemented interface 'NationalInstruments.ISynchronizeCallbacks'. Add one to your project. C:\Documents and Settings\eyynlle\My Documents\Visual Studio 2010\Projects\G\G\Form1.vb 3 14 G
Error 3 Reference required to assembly 'NationalInstruments.Common, Version=9.0.40.362, Culture=neutral, PublicKeyToken=dc6ad606294fc298' containing the implemented interface 'NationalInstruments.ISynchronizeCallbacks'. Add one to your project. C:\Documents and Settings\eyynlle\My Documents\Visual Studio 2010\Projects\G\G\Form1.vb 5 17 G
But I noted that in the SingleReadWrite.2010 example, the program was able to use 9.0.40.157+9.1.40.159 without error. Why? Also strange to me is how was
Private GpibDevice As Device
in line 49 generated by the windows design code? I did not see any "GPIB" control on the form.
Sorry for the long message. Please help. I need to add GPIB function to an existing vb2010 program. I can't take vb2008 then convert to 2010 route. Thanks
12-09-2011 02:00 PM
Hi YL_Ericsson,
I can see that you are getting a warning and also some errors. The best approach to troubleshoot this is to focus on the errors.
These errors you are getting are basically telling you that dll NationalInstruments.Common is not been referenced. So, the first step you would need to take is to add a reference to that dll. For instructions on how to add a reference in Visual Basic you can use this link.
Once you have added the reference you will also need to import that dll into your program, same as you did to import the NationalInstruments.NI4882.
After going through these steps you shouldn´t get those errors anymore.
Regards,
01-18-2012 06:52 PM
Hi YL_Ericsson,
Thank your for getting in touch with NI Support. I'm posting the solution we arrived at here on the forums for the benefit of the community.
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.aspx, but to summarize it breifly, this is a subset of the full .NET framework wherein you cannot reference any assemblies that are not included in the client profile. What you need to do is change the Target Framework to ".NET Framework 4." You can do this by right clicking on the project and opening the Properties, then go to the Compile settings and scroll down to the bottom and open the "Advanced Compile Options..." button.
Please do not hesitate to post again should you encounter any further issues with this application, or if you have anything to add based on your experience in troubleshooting this issue.
12-18-2012 06:29 AM
Tried all of the previous solutions and still having issues.
1) Measurement and automation studio has 9.0.40.157 listed for 4.0 dotnet framework
2) SimpleReadWrite is looking for 9.0.40.362
3) Target Framework in project set to ".Net Framework 4", not the client profile one.
4) Add reference brings up to listings for NI Common, 12.0.20.253 and 12.0.35.253.
5) Tried using these and VS throws the same errors. Looking for 9.0.40.362
6) Tried repairing the NI488.2 software to get the 4.0 drivers online, but did not seem to help
Looks like a disconnect between NI and the VS, why are the 4.0 framework NI common not coming up in the references for VS?
12-18-2012 06:57 AM
Nevermind after scrolling through the references it was not clustered with the other NI Common stuff. It was near the bottom, 12.0.40.253 works fine.