Tech Note 30:
Distributing your Application

April 27, 2006

Copyright 2006 NS BASIC Corporation

Overview

Creating a proper installation procedure for Windows CE devices is not a simple task. NS Basic/CE programs need to use the some installation procedures as other applications. In this document, we'll try to make it as easy as possible for you.

It's easiest to use the installers that come with NS Basic, such as Runtime.ppc.exe. If you don't want to do this, you'll have to make your own.

The steps to creating an installer are as follows:

  1. Get the Installer files
  2. Create your .inf file
  3. Create your .ini file
  4. Compile them using cabwiz.exe
  5. Package them using EZSetup.exe
  6. Test them using CEAppMgr.exe
  7. If you have questions

Use of these installer tools is subject to Microsoft's licence agreements. You can read the licence agreement and Microsoft's FAQ on the subject.

Here's a link with some additional explanation, by Ian Ferguson.

Third Party Tools

There are some third party tools that can be used to help build installers.

How to create an installer from scratch

1. Get the Installer files

The installer files are in a folder named \installer the NS Basic/CE Release CD. After installing them on a device, you can copy them back onto your system into a directory that will be accessed by your installer.

2. Create your .inf file

The .inf file contains the information about the files to be installed on your CE device. It contains the pathnames where the files are to be found on your desktop, and where the files should be places on your CE device. Constructing this file properly is the most complex part of creating your installer.

You can look at a sample .inf file here. These can get pretty long and complicated!

Other resources:

  1. .inf File Format Documentation
  2. Sample: .inf for installing NS Basic/CE (as complex as it gets!)
  3. Sample: .inf for installing NS Basic/CE Runtime
  4. Sample: .inf for Script (install VBScript modules)
  5. Sample: .inf for System (install MFC modules)

3. Create your .ini file

The .ini file describes which CAB files are to be included in the installer. Here is a sample .ini file to create an installer for an add on control for NS Basic/CE:

[CEAppManager]
Version = 1.0
Component = DialogX

[DialogX]
Description = DialogX
CabFiles =DialogX.HPCPRO_ARM.cab,DialogX.HPCPRO_MIPS.cab,DialogX.HPCPRO_SH3.cab,DialogX.HPCPRO_SH4.cab,DialogX.HPC_MIPS.cab,DialogX.HPC_SH3.cab,DialogX.PPC_MIPS.cab,DialogX.PPC_SH3.cab

4. Compile them using cabwiz.exe

Cabwiz.exe is a program supplied by Microsoft. You can download it as part of eMbedded Visual Basic. It reads your .ini file and outputs one or more .CAB files. A CAB file is produced for each platform (HPC, HPC/Pro or PPC) and CPU type that you plan to support.

Here is a sample script to start Cabwiz.exe. Save this as a .bat file so you don't have to type it all in each time.

del *.CAB
"D:\Program Files\Microsoft Visual Studio\vb98\vbce\cabwiz.exe" "E:\210\DialogX\DialogX.inf" /err err.log /cpu HPC_SH3 HPC_MIPS HPCPro_ARM HPCPro_SH3 HPCPro_SH4 HPCPro_MIPS PPC_SH3 PPC_MIPS

5. Package them using EZSetup.exe

EZSetup.exe is a handy utility from Scott Ludwig. It uses you .ini file to get the list of .CAB files that Cabwiz.exe produced and makes a single compressed file out of them. EZSetup.exe is in the same folder as CabWiz.exe. EZSetup only works with Windows NT, 2000 at XP.

If you have an older version of Windows, you can do this step using the tools in eVB. Franco Epifani has notes on using this on his website at http://www.efsoft.it.

Here is a sample script to start EZSetup. Save this as a .bat file so you don't have to type it all in each time. You can combine this with the Cabwiz .bat file to build your installer with a single command.

del *.DAT
d:\apps\ezsetup -i DialogX.ini -r DialogXReadme.txt -e e:\210\all\license.txt -o DialogX.exe
del *.CAB

6. Test them using CEAppMgr.exe

Your installer is now complete. When you click on a file produced by EZSetup, the CEAppMgr.exe program is invoked to copy the files to your Windows CE device. You will recognise this program: it's the standard application installer.

If you'd like to do this automatically from your .bat file, use this command:

"C:\Program Files\Microsoft ActiveSync\CEAppMgr.exe" "E:\210\DialogX\DialogX.INI"

7. CECabMgr

submitted by Shimoe

I first bought WinCE CAB Manager from http://www.ocpsoftware.com/products.php?nm=cecabmgr It cost me $150, but it was cheap for me if considering analyzing the inf file.

  1. Installed Runtime.ppc.exe
  2. Copied all CAB files in "C:\Program Files\Microsoft ActiveSync\Runtime" to a folder.
  3. In WinCE CAB Manage, ADDed the program I developed.
  4. Referred to "Setup.ini" in "C:\Program Files\Microsoft ActiveSync\Runtime" and modified for my program.
  5. Used EzSetup.exe to create an installation program. Because EzSetup.exe in NS Basic's CD-ROM was English version, I downloaded EzSetup v2.1 Japanese from http://wince.tripod.co.jp/
It works on my iPAQ but I am not sure if it does on all devices. Here is the installation program that was created: http://www.sabot.co.jp/nstoday/downloads/NSTodaySetup.exe

8. Getting CAB files from exe installers

The exe files used as installers are made up of one or more CAB files, each for a different device type. When the exe file is run on the desktop, all the CAB files are extracted and put into folder on the desktop. The appropriate one is then copied to the device and run to do the installation.

It can be useful to get the CAB file itself, either to look at its contents or to put the CAB file onto a card for installation without using ActiveSync. To do this, run the exe file without a device being connected. You will find the CAB file in

    C:\Program Files\Microsoft ActiveSync\BASIC\

9. If you have questions

We'd like to be able to provide the same level of support for installation issues as we for for NS Basic/CE itself, but this is all software that doesn't come from us. We can offer tips based on our own experience and act as a central point for keeping track of good ideas our users have on creating installers.

If you have questions, post them on our web board. If we can't answer them ourselves, perhaps another user can.

We will add to this document with new information and suggestions you submit. Hopefully, we'll develop this into something that is easily usable for all!