01-19-2012 07:51 AM
Hi,
We developed an application using VisualStudio 2010, .NET 4.0, target x86, NI-DAQ 9.4 driver and a NI-6210 USB. It works fine on our development computers but we're experiencing issues when deploying it.
We want this application to run even if the DAQmx-Core / DAQmx driver is not installed. In this case, of course, no data are acquired but the program must start and warn the user that the driver has not been found. However, our program crashes at startup if the driver is not installed, displaying this exception "Unable to liad the file or assembly NationalInstruments.DAQmx.dll or one of his dependancies".
The VisualStudio deployment project seems to detect the right dependancies has shown below.
The installation ends up fine and the DAQmX.dll library is copied on the target computer at the root of our program directory, the other NI files are in the GAC folder.
Are we missing something ?
How is it possible for our application not to crash on startup if DAQmx isnt installed ?
Thank you for support,
Regards,
Florent.
01-24-2012 03:20 AM
Hi Florent,
Thank you for posting on NI's Discussion forum.
Have you selected the component for .NET when you have installed NI-DAQmx driver ?
Regards,
Vincent.O
National Instruments France
Été de LabVIEW 2014
12 présentations en ligne, du 30 juin au 18 juillet
01-24-2012 04:38 AM
Hi Vincent,
Thanks for your answer.
The component for .Net has been installed on our development PCs but isn't on the target one. As I explained, we expected our program to run (and warn the user that he cannot acquire any data) even if the driver is not installed. Dependancies are correctly detected and NI.DAQmx.dll is copied on the target computer but it doesn't work...
In fact, our customers use the same program to acquire datas (on a laptop) and then to process it on another computer (at the office). They don't need the NI driver on the office computer because no NI interfaces are connected.
Regards,
Florent.
01-24-2012 07:37 AM
Hi Florent,
I suggest you to try this :
In Visual Studio 2010, go to Project -> Properties -> Compile -> Advance Compile Options. Set the target Framework to .NET framework 4
Then you should be able to see National Instruments.DAQmx.dll with the other dependencies of your project.
I hope this helps,
Regards,
Vincent.O
National Instruments France
Été de LabVIEW 2014
12 présentations en ligne, du 30 juin au 18 juillet
01-24-2012 08:24 AM
Hi Vincent,
The target framework is already set to .NET 4, the target platform is x86. And the merge module mstudiodaqmx.2010.msm is detected as a dependancy (as shown on the attached picture in my first post) in my deployment project. NationalInstruments.DAQmx.dll library is copied on the target computer at the root of our program directory but I get this exception when DAQmx driver isn't installed whereas the program is not trying to communicate with an NI interface. It's only loading the DAQmx.dll to know if an interface is aivalable.
I hope my post is clear now,
Regards,
Florent.
01-24-2012 11:06 AM
Hi Florent,
I'm trying to find any document which could be helpful for you, i found this KB thanks to a previous post one the Forum.
After reading again you first post i saw that you put NationalInstruments.DAQmx.dll in the root of you program directory, can you try to put it in the GAC folder ?
Regards,
Vincent.O
National Instruments France
Été de LabVIEW 2014
12 présentations en ligne, du 30 juin au 18 juillet
01-25-2012 02:57 AM
Hi Vincent,
I had already found this KB and followed its instructions. The right merge modules are automatically detected by Visual Studio so I think this step is fine.
I did not copy manually the NationalInstruments.DAQmx.dll file in my program folder but the deployment project did and I don't kow why because the other NI assemblies are in the GAC folder. I copied manually the NationalInstruments.DAQmx folder from my computer's GAC_32 folder to the target computer but the exception remain the same. However I think this kind of files needs an installer to be recognized by Windows...
I tried to add / delete these files on my computer. If C:\ Windows\ Microsoft.NET\ assembly\ GAC_32\ NationalInstruments.DAQmx\ v4.0_9.4.40.50__dc6ad606294fc298\ NationalInstruments.DAQmx.dll and C:\ Program Files\ MyProgram \NationalInstruments.DAQmx.dll are deleted at the same time then the program is crashing the same way than on the target computer. If only one of the 2 files exists, it works.
Thanks for your help,
Regards,
Florent.
02-01-2012 09:30 AM
In response to your statement "We want this application to run even if the DAQmx-Core / DAQmx driver is not installed. In this case, of course, no data are acquired but the program must start and warn the user that the driver has not been found".
You have a couple of options:
The snippet above should work as I tested it on a machine with just the DAQmx assemblies installed and not the underlying driver.
Hope this helps.