From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems loading NI assembly in Click-Once Application

Solved!
Go to solution

I built an application to measure current consumption from a device in Visual Studio 2012. I built a library for the National Instruments USB-6008 and added the dll from C:\Program Files (x86)\National Instruments\MeasurementStudioVS2012\DotNET\Assemblies\Current, which is 9.9. Everything ran smoothly on my dev machine so I pushed all changes to the production server, which is packaged as a Click-Once app.

 

On the machine running the actual Click-Once app, I downloaded and installed the driver fir 9.9 from here: http://www.ni.com/download/ni-daqmx-9.9/4707/en/. When the application gets to the point where it measures the current consumption, I get the error: 

 

System.BadImageFormatException: Could not load file or assembly 'NationalInstruments.DAQmx, Version=9.9.45.39, Culture=neutral, PublicKeyToken=4febd62461bf11a4' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'NationalInstruments.DAQmx, Version=9.9.45.39, Culture=neutral, PublicKeyToken=4febd62461bf11a4'

 What am I doing wrong?

0 Kudos
Message 1 of 3
(4,200 Views)

Hi Musent,

 

Unfortunately, ClickOnce deployment is not supported with Measurement Studio or any National Instruments .NET components, including any NI drivers.  The following knowledge base article documents this pretty well.

 

http://digital.ni.com/public.nsf/allkb/148A815DF9379F8786257560005DB06A?OpenDocument

 

If you read through that and check out the links at the bottom, it suggests using a windows installer and installing these components separately.

-Jim B
Applications Engineer, National Instruments
CLD, CTD
0 Kudos
Message 2 of 3
(4,176 Views)
Solution
Accepted by Musent

The solution I found for this problem was to install the Examples for Measurement Studio. Not sure why this needs to be installed on the machine running the Clickk-Once App though.

0 Kudos
Message 3 of 3
(4,081 Views)