08-25-2015 05:05 PM
I am trying to use Visual Studio 2010 to control some instruments over a GPIB connection using Visual Basic. I have the code working properly onVS2013 running a 4.5 framework, but I'm required to have the code working onVS2010 running the 4.0 framework. On my laptop with the 4.5 framework everything works flawlessly by adding references to NationalInstruments.Common.dll andNationalInstruments.NI4882.dll, then declaring my device using
Dim GPIBdevice As New Device(CInt(0), CByte(9), CByte(0))
On my desktop running VS2010 and the 4.0 framework I run into an error. The code initially recognizes the "Device" class and even has Intellisense pop up with the different constructors possible. When I build the program, I receive an error and a squiggly line pops up under "Device"
The error says that I'm missing a reference. I'm having the same error as http://forums.ni.com/t5/Measurement-Studio-for-NET/Missing-assembly-NationalInstruments-Common-Versi...
I'm not too familiar with programming and my supervisor said he'd like to avoid using the GAC. Are there any more recent ways to solve this issue or is adding stuff to the GAC my best bet? In the solutions posted in the thread above they mention editting a Common.wxs file, but a search doesn't have that pop up. Where would this file usually be located?
08-27-2015 01:50 PM - edited 08-27-2015 01:50 PM
I have Visual Basic 2010 Express and NI-488.2 3.1.2 installed on my desktop at home; I have no problem.
08-27-2015 02:22 PM
I ended up butchering the SimpleReadWrite example provided for DotNET4.0 and managed to get everything working, despite not really understanding why it's working. The example references the exact same Dll's as I was doing before, but it doesn't throw out an error.
The referenced files are C:\Program Files (x86)\National Instruments\MeasurementStudioVS2010\DotNET\Assemblies\Current\NationalInstruments.Common.dll
and C:\Program Files (x86)\National Instruments\MeasurementStudioVS2010\DotNET\Assemblies\Current\NationalInstruments.NI4882.dll
I tinkered a bit more while posting this and it looked like the default target framework was ".NET Framework 4 Client Profile", and when I changed it to just ".NET Framework 4" it compiled correctly too.