08-10-2009 01:51 AM
Hi.
With Visual Studio 2008 Pro I programmed a wrapper dll that wraps mx drivers (.NET) functionality for a program that is programmed with C++ Builder (COM). The problem is that even if I install the NI-DAQmx driver (which I downloaded from NI's web page) the wrapper doesn't work. It crashes when I try to create a class that uses NI-DAQmx librarys class methods.
I have copied both NationalInstruments.DAQmx.ComponentModel.dll and NationalInstruments.DAQmx.dll to the same folder where my wrapper is but it does no good.
I then created a setup project (Visual Studio) for that wrapper and when I installed the wrapper using the installer everything worked just fine. So there must be other dll's that are required but what.
The wrapper is distributed with the (COM) program so needles to say I don't want to use any installers for the wrapper.
Obviously I lag some information how to create a full-fledged redistributable dll without an installer so could someone give me the gist of it... 🙂
-J-
Solved! Go to Solution.
08-17-2009 02:56 AM
You telling me that nobody has done this the way I have?
Here's a screen capture of the setup's folder. I enabled the "As loose uncompressed files" option in the setup project propery pages.
Cheers,
-J-
08-17-2009 02:41 PM
You can find a list of all the assemblies you need when doing XCOPY deployment under the Measurement Studio .NET XCOPY Deployment Files help topic in the NI Measurement Studio Help. It lists out all the assemblies you need to deploy. It looks like you are missing the NationalInstruments.Common.** assemblies.
Check out the Locations for the NI-DAQmx .NET Help Files link to open the help if you just have NI-DAQmx installed and not Measurement Studio.
Best Regards,
08-18-2009 03:08 AM
Hi Jonathan and thanks for the info.
Unfortunately it didn't do no good. I located the list and copied the required files (NationalInstruments.Common.dll, NationalInstruments.Common.Native.dll and NationalInstruments.DAQmx.dll) to the target computer's folder but the program still doesn't work. Thanks to Vista it just gives an error message that the application has stopped working.
I didn't need those NationalInstruments.Common.* files, afterall. The project compiled perfectly having only NationalInstruments.DAQmx.dll in the project references.
Here's a screencapture (Setup1.jpg) of the merged modules that are included in the installer. Is there a way to XCOPY those files?
Regards,
-J-
08-18-2009 12:31 PM
Hi J,
Actually the Common assemblies are required if you are building against the DAQmx assembly. These Common assemblies must be on the target system in a place where Fusion can locate them at runtime.
Since it appears you need to deploy the VC runtime merge modules, you should be able to just copy over the msvcp90.dll and msvcr90.dll to your target system. You should be able to find these DLLs in the C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT directory.
Honestly J, if you don't have a particular reason for not using the merge module route, I would highly recommend going down that path. This way you avoid having to worry about the underlying dependencies. You just let VS decide what merge modules its needs. But then again, there are times when you might want to XCOPY.
Best Regards,
08-19-2009 02:16 AM
Thanks again, Jonathan.
I know what you mean but I have to deploy my wrapper without any installers because that's how it's done before and it would be a pretty big task to change the routine.
Still the problem stays and the program crashes when I try to utilize my wrapper. It seems that it doesn't even get there where I create an object of the VC++ class I've programmed. This class then uses NationalInstruments.DAQmx.* members. In the constructor I write to an output file but it doesn't exist after the crash. So there's definitely something still missing. I even installed Microsoft's VC++ 2008 SP1 runtime to the target computer but it does no good.
Thank you for you support and if you still have some ideas feel free to let me know. I won't mind. 🙂
Regards,
-J-
08-19-2009 02:32 AM
Ok, I was wrong about when it crashes. It crashes when it tries to use NationalInstruments.DAQmx.* for the first time (DaqSystem::Local->GetPhysicalChannels(PhysicalChannelTypes::AI, PhysicalChannelAccess::External);).
So the VC++ runtime seems to be correctly installed but there's still some NI library(/ies) missing.
I have attached two screenshots. "common.jpg" shows what files are in commom merged module and "daqmx.jpg" shows what's in daqmx msm.
Do I have to include those config and policy files? daqmx msm has that ComponentModel library. I haven't been able to locate it anywhere on my devlopement computer...
I better run the wrapper installer and copy the dll's to another place where I can then XCOPY them.
-J-
08-19-2009 03:19 AM
Ok, I narrowed it down a little bit. I excluded all merged modules from the setup project and then one by one I included them while testing the installation each time.
Um... I've never deployed anything using XCOPY so a basic question: Do I have to copy those policy and config files to GAC (Global Assembly Cache) folder even when using XCOPY? They are installed there by the MSI and when I excluded the particular merged module the program crashed. When I re-included it, installed and run my program everything worked fine - even when I excluded both VC90 related merged modules. Probably because I have installed it myself on the target computer...
-J-
08-20-2009 06:25 AM
Just got this thing working. Default settings in NI-DAQmx driver installation were insufficient. I had to enable .NET 3.5 support, too. Now it works perfectly even without any NationalInstruments.* dll's in the program folder.
Hope this helps others if they have this same problem.
-J-
08-20-2009 09:20 AM
When you enable that feature, it installs both the NI-DAQmx assemblies along with the Common assemblies into the GAC. Thus your application ends up using the assemblies in the GAC.
Those policy files are there so we can redirect applications to always use the newest version of Common installed on the system. The reason this is import is because if you XCOPY an application without an configuration file and the assemblies in the application were built with an older version of Common, deployment doesn't work.
Common is a little weird with regards to XCOPY deployment. You can read more about this in the Measurement Studio .NET Class Library Versioning for Development and Deployment topic.
Glad you are up and running.
Best Regards,