참고 : http://digital.ni.com/public.nsf/websearch/ED87C183E056CAC386256DF1004E54C6?OpenDocument

 

Distributing Measurement Studio Applications in Microsoft Visual Studio 2003/2005/2008/2010

Primary Software: Measurement Studio>>Measurement Studio for .NET Support
Primary Software Version: 8.0.1
Primary Software Fixed Version: N/A
Secondary Software: Measurement Studio>>Measurement Studio for Visual C++, Measurement Studio>>Measurement Studio for Visual Basic 6


Problem:
I have created a .NET application that contains Measurement Studio components and want to distribute my application to another machine. What do I need to do?

Solution:
In order for a .NET application that contains Measurement Studio components to run properly on a target machine, the target machine must contain certain Measurement Studio components.

Microsoft Visual Studio .NET makes distribution much easier by providing Setup and Deployment Projects. Setup projects allow you to create installers in order to distribute an application. The resulting Windows Installer (.msi) file contains the application, any dependent files, information about the application such as registry entries, and instructions for installation.

Complete the following steps below to create a deployment project using Visual Studio 2003/2005/2008/2010 that contains the necessary Measurement Studio components.

  1. Open an existing Visual Studio project or example program.
  2. Build and execute the windows application to verify that there are no errors.
  3. Add a new project to your existing project by:
    • Visual Studio 2005/2008/2010 - Select File ? Add ? New Project.
    • Visual Studio 2003 - Select File ? Add Project ? New Project.
  4. In the resulting Add New Project dialog box:
    • Visual Studio 2005/2008/2010 - Select Other Project Types ? Setup and Deployment .
    • Visual Studio 2003 - Select Setup and Deployment Projects.
  5. In the Templates pane, select Setup Wizard.
  6. In the Name box, type "My Installer".
  7. Click OK to close the dialog box and launch the wizard.
  8. Click Next.
  9. Select Create a setup for a Windows Application and click Next.
  10. Check Primary Output for [Name of Project] and click Next.
  11. If your application requires any additional files such as text files or a .ini file, you can add them or just click Next.
  12. Click Finish.
  13. Access the File System Editor by either selecting View ? Editor ? File System or by double-clicking on Primary Output from [Name of Project] in the Solution Explorer. By default, the File System Editor displays a standard set of folders that represent the folder structure on a target computer. (Note: The File System Editor is only available when the deployment project is selected in the Solution Explorer.)
  14. Right-click on the File System on Target Machine node and select Add Special Folder ? Program Files Folder. (Note: This will prevent you from getting the 2705 error on some target machines.)
  15. Check Detected Dependencies to make sure that all merge modules have been added for the components in the project. Most of the time merge modules are automatically detected by Visual Studio, however, in some cases Visual Studio fails to detect them.
  16. If you are using ActiveX controls, complete the following sub-steps, otherwise skip to the next step.
    1. Right-click the "My Installer" setup project and select Add ? Merge Module.
    2. Add CWUI_OCX.msm if you are using any of the graphs, sliders, or other user interface controls, and add the CW3DGRAPH_OCX.msm merge module if you are using the 3D graph. This will add all of the additional dependancies needed for the ActiveX controls. Measurement Studio installs all merge modules in the \Common Files\Merge Modules directory. (Note: If you are using the DAQ ActiveX controls you will need to install NI-DAQ with Visual Basic support prior to running setup or running your application.)
  17. Right-click your "My Installer" project and select Rebuild. This builds your installer that contains all of the dependencies.
  18. To deploy your files to another computer, open Windows Explorer, navigate to your project directory and find the built installer. The default path will be \Documents and Settings\<user name>\My Documents\Visual Studio\Projects\<Solution Folder Name>\My Installer\<project configuration>\My Installer.msi. (The default project configuration is either Debug or Release.)
  19. Copy My Installer.msi, Setup.exe, and all other files and subdirectories in the directory to the target computer.
  20. On the target computer, double-click Setup.exe to run the installer. (Note: You must have install permissions on the target computer in order to run the installer.)

For further information on deploying Measurement Studio applications and which merge modules are needed, refer to the "Deploying Measurement Studio Applications" help topic in the Measurement Studio Documentation.

To download the DAQmx runtime drivers go to ftp://ftp.ni.com/support/daq/pc/ni-daq/daqmx/VERSION_NUMBER/runtime/, where VERSION_NUMBER is the version of the DAQmx driver you are looking for (i.e. 8.5 or 8.1).  For more information about the runtime versions, see "What's New in NI-DAQmx 8.6" in the links section.

Note: If you are deploying to a Windows 7 target system, there are some further configuration steps you must take. Please see the KnowledgeBase article Why Did My Measurement Studio Distribution Not Fully Install In Windows 7?

Related Links:
KnowledgeBase 5KRERUQW: Why Did My Measurement Studio Distribution Not Fully Install In Windows 7?
KnowledgeBase 3332LH42: Error -2705 from the MSI Installer Built with the Visual Studio .NET Installation Builder
KnowledgeBase 2W3G520Q: Distributing Measurement Studio ActiveX Applications
MSDN - Deploying a Windows Application