How do you create a Smart Device installation in .NET 2003?

Posted on 2004-03-22
Last Modified: 2007-12-19
I need to create a setup file for a Pocket PC App. I have never done so I went to MSDN for help and they showed examples of a Smart Device Setup in the Setup and Deployment options. I do not have that and from what I understand it is part of Smart Device Extensions. I have looked all over for an installation with no luck. How do I get the option to create a smart device setup in .NET.
Question by:Duiji99
  • 2
LVL 28

Accepted Solution

iboutchkine earned 125 total points
ID: 10657194
Check this. Very nice article covering almost everything

also another

The following are key points when developing and deploying Pocket PC applications:

Pocket PC devices have different processors (ARM, SH3, MIPS, etc.).
Applications are deployed using cabinet (.cab) files.
Each processor type requires a different .cab file.
The Cab Wizard (cabwiz.exe) generates processor-specific .cab files.
The WinCE Application Manager deploys and installs .cab files on Pocket PC devices from the desktop.
The deployment process and uninstalling are discussed first, followed by development and automating
the development process.

Users can install Pocket PC applications by copying and running the appropriate .cab file to their device,
 but a better solution installs the application on the device by running a .msi file on their desktop.
This .msi file detects the type of device, copies the correct .cab file to the device, and installs
the application by running the .cab file. All of this is transparent to the user; they run a .msi file on their
desktop and the application is automatically installed on the Pocket PC.

The following are the steps involved in the MSI-based deployment:

User runs the .msi file on their desktop.
The .msi file unpacks processor-specific .cab files, setup.ini and a custom installer component.
The installer component is executed during the installation, and deploys and installs the correct .cab file to
the device by running the WinCE Application Manager.
The setup.ini file describes the application to the WinCE Application Manager.
The diagram below shows the pieces involved in this process followed by information on each piece.

.msi File
The .msi file is the single file that installs your Pocket PC application from the desktop. The user runs
the .msi file and it unpacks processor-specific .cab files, a customer installer component, and a setup.ini file.

.cab Files
Pocket PC applications are installed by running .cab files on the device. These are self-extracting files that contain installation instructions and all of the files required by the application. The files are processor-specific, so a separate .cab file is required for each processor type supported by the application.

Installer Component
This is a custom installer component that is executed during the installation process. It runs the WinCE
Application Manager to copy and install the correct .cab file to the device.

Setup.ini File
This initialization file describes the application to the WinCE Application Manager and is required to install
apps through the application manager.

WinCE Application Manager
The WinCE Application Manager (CeAppMgr.exe) resides on the user's desktop system and is used to install
and uninstall applications on Pocket PC devices. The following shows the application manager prompting
the user to install the sample application on the Pocket PC device.

The .cab file stores information on the Pocket PC so the application can be uninstalled. Users can uninstall
the application using the Pocket PC directly or from the desktop. To uninstall the application using
the Pocket PC, users select Remove Programs from the Settings application, as shown below.

Just like installing, users can also uninstall the application from their desktop. They select the application
from the Control Panel application Add or Remove Programs and click the Remove button. This executes
the custom installer component that runs the WinCE Application Manager in uninstall mode (does not specify
a setup.ini file). The user unchecks the application and clicks OK to uninstall the application from the Pocket
PC device.

The development goal is to generate the .msi file with the least amount of work (one click if possible).
First, let's see what pieces are involved in the development process:

The BuildCab.bat file starts the process by running the Cab Wizard.
The information file (.inf) describes the application to the Cab Wizard.
The Cab Wizard generates different .cab files for the processor types specified in the .inf file.
The .cab files, along with a custom installer component and a setup.ini file are packaged into a .msi file.
The diagram below shows the pieces involved in this process, followed by information on each piece.

The BuildCab.bat file builds processor-specific .cab files by running the Cab Wizard tool. Visual Studio
generates a template BuildCab.bat file when you select Build Cab Files from the Build menu. It's a good idea
to let Microsoft® Visual Studio® generate this file, then copy it to a different location and make any
changes. Most likely, the only change required is specifying a new path for the .cab and log files.
The sample BuildCab.bat is shown below.

"C:\Program Files\Microsoft Visual Studio .NET
  2003\CompactFrameworkSDK\v1.0.5000\Windows CE\..\bin\..\bin\cabwiz.exe"
  "c:\program files\pocketpc deploy
  sample\Source\CS\PocketApp\BuildCabs\PocketApp_PPC.inf" /dest
  "c:\program files\pocketpc deploy
  sample\Source\CS\PocketApp\BuildCabs\Cabs" /err CabWiz.PPC.log /cpu

Information File (.inf)
The Microsoft Windows® CE .NET .inf file specifies installation settings and application files to the Cab
Wizard. Like the BuildCab.bat file, Visual Studio generates a template .inf file when Build Cab Files is selected.
 You should initially generate this file with Visual Studio and then copy it to another location to make any
changes. The file usually requires minimal changes; usually just updating the Provider name.

Visual Studio generates a .inf file that contains references to vsd_setup.dll. This component is used for
version checking and reports information if the Pocket PC device does not have the correct version of the
.NET Compact Framework installed. It is a good idea to keep this in your application but it has been
removed from the sample code for simplicity.

A sample file is shown below. You can visit Microsoft Windows CE .NET: Creating an .inf File for more
 information on .inf files.

Signature="$Windows NT$"
Provider="Sample Company"
CESignature="$Windows CE$"




1=,"Common1",,"C:\Code\Microsoft\Pocket PC


Shortcuts=0,%CE2%\Start Menu


Cab Wizard
The Cab wizard (cabwiz.exe) generates .cab files that can be installed on different Pocket PC devices.
A .inf file is used to describe the application to the wizard and is passed as the first argument on the
command line. Other optional arguments are the destination directory, error log file, and CPU types. You
 can visit Microsoft Windows CE .NET: CAB Wizard Syntax for more information on running the wizard.

Installer Component
The custom installer component automates the deployment process by handling the AfterInstall and
AfterUninstall events and running the WinCE Application Manager. The path to the application manager
is stored in the registry under the
HKLM\software\Microsoft\Windows\CurrentVersion\App Paths\CEAppMgr.exe registry key.
The code for the AfterInstall and AfterUninstall events is shown below.

Private Sub Installer_AfterInstall(ByVal sender As Object, _
   ByVal e As System.Configuration.Install.InstallEventArgs) _
   Handles MyBase.AfterInstall

   ' get fullpath to .ini file
   Dim arg As String = Path.Combine(Path.GetDirectoryName( _
      System.Reflection.Assembly.GetExecutingAssembly().Location), _

   ' run WinCE App Manager to install .cab file on device
End Sub

Private Sub Installer_AfterUninstall(ByVal sender As Object, _
   ByVal e As System.Configuration.Install.InstallEventArgs) _
   Handles MyBase.AfterUninstall
   ' run app manager in uninstall mode (without any arguments)
End Sub

Private Sub RunAppManager(ByVal arg As String)
   ' get path to the app manager
   Const RegPath As String = "Software\Microsoft\Windows\" & _
      "CurrentVersion\App Paths\CEAppMgr.exe"

   Dim key As RegistryKey = Registry.LocalMachine.OpenSubKey(RegPath)
   Dim appManager As String = CStr(key.GetValue(""))

   If Not (appManager Is Nothing) Then
      If arg Is Nothing Then
      Process.Start(String.Format("""{0}""", appManager))
         ' launch the app
         Process.Start( _
            String.Format("""{0}""", appManager), _
            String.Format("""{0}""", arg))
      End If
      ' could not locate app manager
      MessageBox.Show("Could not find app manager")
   End If
End Sub
Setup.ini File
The .ini file describes the Pocket PC application and is required when using the WinCE Application Manger
to deploy applications to Pocket PC devices. The sample setup.ini file is shown below. You should set the
Version, Description and CabFiles properties in your application. You can visit Microsoft Windows CE 3.0:
Creating an .ini File for the Application Manager for more information on .ini files.

Version      = 1.0
Component    = App

Description  = Sample Pocket PC application.
CabFiles     =
.msi File
This is the file that is distributed to users. It contains everything necessary to deploy the Pocket PC
application from the desktop to different Pocket PC devices.

Automating the Development Process
Now that you are familiar with all of the pieces involved in the development process, let's see how the build
can be automated. The key points are:

Create one solution with multiple projects (Pocket PC app, customer installer, and setup).
Add the installer component as Install and Uninstall custom actions in the setup project.
Use a pre-build event to call the BuildCab.bat file to generate the .cab files.
Specify project dependencies so projects are built in the correct order.
Use Configuration Manager to build the Pocket PC application for debug builds, and build all projects for
release builds.
The following section discusses the C# and Microsoft Visual Basic® .NET sample solutions in more detail.
The C# solution builds all projects (Pocket PC app, custom installer component and .msi file) with one click.
Visual Basic.NET requires more steps since Microsoft Visual Studio® is missing these two features:

A solution cannot contain VB.NET projects that target different platforms (the Pocket PC app cannot be in
the same solution as the custom installer component).
Pre-build and post-build events are not supported for any VB.NET projects.
The VB.NET solution is still automated, just not as much as the C# version.

Solutions and Projects
The C# solution contains three projects: PocketPC App, Custom Installer and Setup. The PocketApp project
 is a Smart Device application that contains the Pocket PC code. The CustomInstaller project is
the customer installer component and the Setup project packages up everything into a .msi file.

Two solutions are required for VB.NET. The first contains the Smart Device project called PocketApp.
The second solution generates the .msi file and contains the projects CustomInstaller, Pre-Build and Setup.
The CustomInstaller and Setup projects are equivalent to the C# projects and the Pre-Build project
is a C++ Makefile project; it does not contain any C++ code and is only used to specify a pre-build event.
The VB solutions are shown below.

PocketApp project
The PocketApp project is a simple Smart Device, "hello world" application; a placeholder for your Pocket PC
project. The BuildCab.bat and PocketApp_PPC.inf files are used to build the .cab files and the setup.ini file
is used when deploying the application. The app.ico file is the application icon and appears in Programs
group on the Pocket PC. Specifying the application icon is shown for the C# and VB.NET versions.

CustomInstaller project
This is the component that runs the WinCE Application Manager to deploy .cab files to the Pocket PC device.
 The code for the C# and VB.NET versions is shown earlier in this paper.

Setup project
The Setup project generates a .msi file that contains the processor-specific .cab files, installer component,
and setup.ini file.

Pre-build event
You need to run the BuildCab.bat file to generate the .cab files after the PocketApp project is built.
Visual Studio does not allow you to specify post-build events for C# Smart Device projects, so we do the
next best thing and define a pre-build event for the CustomInstaller project.

Project dependencies
It's important to set the correct build order since the solution contains multiple projects. For C#, the build
order is set to PocketApp
The VB.NET version contains two solutions; the PocketApp solution should be built first, followed by the
PocketPCSetup solution.
Configuration manager
Configuration Manager is used to build the Pocket PC project in debug mode and all projects in release mode.
That way, you don't go through the entire build process just to debug the Pocket PC application.
This is not necessary for the VB.NET version since it has one solution for the Pocket PC app and another
solution to generate the .msi file.

Installing and Building the Sample Solutions
The following are notes on installing and building the sample solutions.

Run the PocketPC Deploy Sample.msi file to install the C# and VB.NET solutions to your system. Links to the
Visual Studio solution files are added to the Start menu under the PocketPC Deploy Sample group.
The hard coded paths in the BuildCab.bat and PocketApp_PPC.inf files are updated to match your system
(path to sample installation folder and Visual Studio). You should double-check the path information in
these files if you have trouble building the samples.
Select release mode to build all projects (debug just builds the Pocket PC app).
The .msi file is called PocketApp Setup.msi and is created in the Setup\Release folder.

Expert Comment

ID: 10781902
This pdf document gives step by step info…it helped me a lot (good luck)

Expert Comment

ID: 14786760
I know this has been accepted and closed but here is my question. When I create CAB files from VS.NET 2003 I get the following files


My Processor is a Intel, Intel(R)-PXA255. My question is what CAB file do I use? this is a symbol 9060g running Windows CE.NET

Expert Comment

ID: 14808044
The quickest solution and I don’t know if it’s the best is, when you install you application through the compiler, read the installation notes created by .net. The notes created tell you what cab file die compiles installed. Hope this help….

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question