Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Could not load file or assembly 'NationalInstruments.DAQmx,

I just created a small CS program to digital I/O on the NI6009 (USB) and NI6225 (PCI).   I get the following error when attempting to run it:

Could not load file or assembly 'NationalInstruments.DAQmx, Version=8.7.20.11, Culture=neutral, PublicKeyToken=4544464cdeaab541' or one of its dependencies. An attempt was made to load a program with an incorrect format.

   at Test.NIDevice.Initialize(String deviceName)

   at Test.MainForm._startDevice() in C:\Users\UserName\Documents\Visual Studio 2005\Test\MyApplication\TestIO\MainForm.cs:line 100

 

This is a pretty vague error, I’m stuck and asking if someone can explain how to go about resolving  this problem.

 

Thanks,

 

Ian

 

0 Kudos
Message 1 of 5
(8,360 Views)
Hi Ian,
  • Are you running on a 64-bit OS?
  • What do you have set for your Platform target type for your project? It should be x86 but maybe yours is set for x64? You can access this setting in the Build tab of your projects properties. 
  • Have you tried running a shipping example to ensure that the issue isn't on a global stance? Maybe its jus a setting in your specific project. Running a basic DAQmx .NET example should help determine this.  Check out the NI-DAQmx, NI-VISA and NI-488.2 .NET Example Locations KB for example locations.

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 2 of 5
(8,352 Views)

Hello Jonathan,

Yes, I am running Vista Home x64

I will be able to look at this in more detail tonight.  Having said that, I quickly set the platform to x86 (it was previously set to 'Any CPU') and I was able to run my application. 

Very quickly, can NI-DAQmx not be compiled for a 64 bit processor?

 

Thanks,

 

Ian

0 Kudos
Message 3 of 5
(8,348 Views)
Hi Ian,

The DAQmx .NET class library is designed to work on 64-bit OS's but it can't be used in 64-bit applications.  To use the DAQmx .NET class library on a 64-bit OS, you must configure the project to build 32-bit applications or libraries.  For more information on DAQmx and 64-bit, check out this post.

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 4 of 5
(8,345 Views)

Hello Jonathan,

This information was very helpful.   I had assumed the NI user DLL's were 64 bit.   One last question.  I am able to compile the NI .NET examples using 'Any CPU' platform.   How doe the C# compiler know to us only the x86 platform and not the x64 platform?

Thanks,

 

Ian

 

0 Kudos
Message 5 of 5
(8,343 Views)