Tuesday, December 27, 2011

How To Make a Distribution Kit

   
Written by Erez Wenger and Tal Alon - December 2011

Congratulation, you've finished a CVI project. Whether you want to run your project on another computer that doesn't have CVI, send it to a friends or start publishing it, the next step is to build an installer or a  distribution kit.

* If you want to run the project on another computer without making the distribution kit, it must have CVI installed, as all CVI made applications require the CVI Run-time Engine.

In this post we show how to easily create such a distribution kit.

The first thing we normally do is making sure that the .uir file will be included in the final .exe and will not appear as a separate file. On the upper menu bar click Build->Target Settings


The target settings window will open, you will have to check the followings:
  • The Embed project UIR's is checked.
  • If you want to add an icon to the project, specify an icon file. if you want to draw your own icon, CVI has an Icon Editor tool (see the How to).

Run the project to see that everything still works fine and check that the icon looks OK (if you specified another icon file).

It is preferable in this stage to run your program in release mode, as it is the release mode .exe file that is included in the distribution kit (it will be created automatically even if you skip this step). The difference between release and debug modes is that the debug version has additional code lines enabling run time analysis and debugging, usually making it larger in file size and definitely making it slower as it runs. Note that in release mode the debugger is turned off so if you have an error the debugger won't be activated. 

to switch your project to release mode click Build->Configuration and select 'Release'.




Now click Build->Distributions->Manage Distributions



For a new distribution click the 'New' Button, you can click the 'Edit' button to edit an existing distribution settings.


The 'Edit Installer' window will pop up, in this window you'll have to specify the settings of the installer, we'll only concentrate on the most crucial parts that will get us to a fully functional distribution kit.

On the top of the 'General' tab specify your application's name in the Application Name field.


Now click the 'Files' tab which is a vital part of the distribution kit creation process. Using this tab you will be able to specify which files are included in the distribution kit as they are needed for your application to run correctly. these files will be added to the installer and later on they will be added to the working directory.


The top part of the tab shows your computer as it is now, and you can browse and find any file on you system. The lower part simulates the file system of a computer on which the application will be installed.

Simply choose the files or directories you want to add on the upper part of the window and click on the Add File/Directory Button. Make sure they appear in the lower window and in the correct relative folder.

What you should not add: code files, project files and pictures that you have loaded through the GUI editing window. 

What you should add: needed external DLL files and any other text, sound, image, files that are accessed during the operation of the application.

In the 'Shortcuts' tab you can specify what shortcuts will be added after the installation, the default is set to the Start Menu->Program Files, you can also specify a desktop shortcut. To add another shortcut right click on the white space below the existing links.


If you don't intend to use any hardware, or if CVI is asking you for drivers that you don't have, what you'll need to do is: select the 'Drivers & Instruments' tab, expand the LabWindows/CVI Run-Time Engine group and uncheck the option for Instrument Driver Run-Time (like in the photo below). (The problem is that in newer versions of CVI, National Instruments decided to add instrumentation drivers to the distribution kit as a default)


When you are done click OK at the bottom and you will be able to create the distribution kit:

To build the distribution, click on Build->Distributions->Build %Your_Project's_Name%



Wait for the build to complete and there you have it, you have created your distribution kit.

The Distribution Kit directory will be added to the project's work directory and will be called cvidistkit.%your_project's_name%.



In this folder you will see the installation files, ready to be installed wherever you want. Burn the directory as is or copy it to a portable media device, FTP, Email, etc...

* Note that any CVI program (even the simplest one) needs the CVI Runtime-Engine, and therefore it is automatically included in the distribution kit making it bigger in size.

3 comments:

  1. Nice article, self explanatory! I hvn't tried it so far, but just out of curiosity, I want to know whether this distribution kit will be platform independent i.e. will it run on windows as well as linux distro or Mac ? If not then what extra effort we need to put to make release compatible to linux distros. Thanks again for this nice article :)

    ReplyDelete
  2. Hi Ankur, thank you for your compliment. Regarding your question: unfortunately (as far as I know) there is no way to compile and create a distribution kit on windows that will also install and run on Linux. BUT you can buy CVI for Linux and thereafter distribute your software on that platform.

    ReplyDelete
  3. Excellent article thank you very much :)

    ReplyDelete