03-20-2018 03:35 AM - edited 03-20-2018 04:01 AM
I try to work with PCI-6509 on Visual Studio 2017 (C#).
First I include dll's into a project.
NationalInstruments.DAQmx.dll
NationalInstruments.Common.dll
Then in the code
using NationalInstruments.DAQmx; private NationalInstruments.DAQmx.Task daqmx_task; private DigitalSingleChannelReader digital_reader; private void ScriptManager_Shown(object sender, EventArgs e) { try { daqmx_task = new NationalInstruments.DAQmx.Task();
string[] channels = DaqSystem.Local.GetPhysicalChannels(PhysicalChannelTypes.DILine, PhysicalChannelAccess.External); daqmx_task.DIChannels.CreateChannel(channels[0], "myChannel", ChannelLineGrouping.OneChannelForAllLines);
digital_reader = new DigitalSingleChannelReader(daqmx_task.Stream); // Configure digital change detection timing daqmx_task.Timing.ConfigureChangeDetection(null, channels[0], SampleQuantityMode.ContinuousSamples, 1000); // Add the digital change detection event handler // Use SynchronizeCallbacks to specify that the object // marshals callbacks across threads appropriately. daqmx_task.SynchronizeCallbacks = true; daqmx_task.DigitalChangeDetection += new DigitalChangeDetectionEventHandler(myTask_DigitalChangeDetection); // Start the task daqmx_task.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); daqmx_task.Dispose(); } }
The code compiles OK. But when I run it crushes with the exception
Could not load file or assembly 'NationalInstruments.DAQmx.dll' or one of its dependencies.
I suspect the dll is not compatible with the .NET framework (V 4.6.1) I compile the project.
Where can I find dll for .NET 4.6.1 ?
03-21-2018 09:38 AM
Hi John,
In this link (DAQmx 17.6 readme) you can find the information regarding the support for Microsoft Visual Studio. DAQmx 17.6 is the latest version of DAQmx and you can see there that the latest version of the .NET framework supported is version 4.5.1
(Visual C# .NET and Visual Basic .NET). Version 4.6.1 is still not listed as one of the supported languages.
I think that is the cause of your problem.