RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Create Setup Files for your Windows Mobile Applications Using Visual Studio 2005 : Page 4

Learning a simple series of steps in Visual Studio 2005 will make deploying applications to mobile devices a no-brainer from here on out. Follow along with this project, which includes step-by-step instructions, code, and a sample .ini file.

Creating the Setup Package
With your .ini file created, the final step is to create a setup project to package together all the files that you created earlier. Add a new project to your current solution by going to File—>Add Project….

Figure 7. Adding Files: You now need to add these three files to the Setup project. The file system location for each file is shown to the right of the file name.
Click the Setup and Deployment project type and select Setup Project. Name the project Setup and click OK. Right-click on Setup in Solution Explorer and select Add—>File….Add the following files to the project (see Figure 7):
  • C:\CustomInstaller\bin\Debug\CustomInstaller.dll
  • C:\SmartDeviceCab1\Debug\SampleApp.CAB
  • C:\CustomInstaller\setup.ini

Right-click on Setup in Solution Explorer and select View—>Custom Actions. This will display the various types of Custom Actions that are supported. The Custom Actions editor allows you to specify additional actions to be performed on the target computer at the end of an installation. You'll use the Install type of Custom Action in the next step, which creates the installer bundle. In the Custom Actions pane, right-click Install and select Add Custom Action… (see Figure 8).

Figure 8. Custom Action: Once you've selected the custom actions pane, adding an Install custom action takes little more than right click.
Figure 9. The Custom Installer: Associate the CustomInstaller.dll with the setup project by picking it and then hitting OK.

This action launches a dialog window. In the "Look in" drop-down list (see Figure 9), select Application Folder. You should see CustomInsaller.dll in the list. Select it and click OK. This is to associate the custom installer application with the setup application.

Now you only need to build the project by right-clicking on Setup in Solution Explorer and selecting Build from the child menu.

Testing the Installation
That's it! You can now test the setup application by going to C:\Setup\Debug and double-clicking on Setup (see Figure 10). But before you do that, ensure that your Pocket PC is connected to your computer via ActiveSync.

Figure 10. Installation: Click on the Setup and then select a location to use for your installation folder.
Figure 11. Confirmation: This message from the Windows CE Application Manager confirms the completion of the installation routine.

When you've done that you'll be asked for an installation folder; use the default (or whichever folder you would prefer) and click Next. Follow the instructions on the screen and if everything is configured properly, you should see a message from the Windows CE App Manager (see Figure 11). The message asks you to check your mobile device screen to make sure the installation installs correctly.

By connecting your Pocket PC device to the network using ActiveSynch, you should now be able to see the application automatically installed on your Pocket PC (see Figure 12).

Figure 12. Safely Installed: You can confirm that the application installed correctly over ActiveSynch by examining the Start menu (shown here using an emulator).
Figure 13. Shortcut Overload: The shortcut will appear in the Programs folder if the Start menu is full.

Note that if the Start menu is full (or contains too many items), the "SampleApp v1" item will not appear in the Start menu; instead it will appear in the Programs folder (see Figure 13).

Another handy thing to know: You can remove unwanted items in the Start menu using ActiveSync by navigating to the \Windows\Start Menu\ folder and then deleting the unwanted shortcuts from the list displayed as you would delete any file..

More Attention for Your Applications
Creating a better installation experience for your end users may seem like a nice, "extra" thing you can do but you'd be better off to learn to think of it as mandatory. For one, it will help ensure that more users will actually use your application—and might result in fewer calls to the help desk for those who haven't mastered their mobile devices yet. This article has highlighted the major steps that you need to perform to deploy a typical mobile application for the Pocket PC platform. The steps described can also be used to deploy Smartphone applications, though for Smartphone other deployment techniques are more common—such as deployment through Web servers, SMS, etc.

Wei-Meng Lee is a Microsoft MVP and founder of Developer Learning Solutions, a technology company specializing in hands-on training on the latest Microsoft technologies. He is an established developer and trainer specializing in .NET and wireless technologies. Wei-Meng speaks regularly at international conferences and has authored and coauthored numerous books on .NET, XML, and wireless technologies. He writes extensively on topics ranging from .NET to Mac OS X. He is also the author of the .NET Compact Framework Pocket Guide, ASP.NET 2.0: A Developer's Notebook (both from O'Reilly Media, Inc.), and Programming Sudoku (Apress). Here is Wei-Meng's blog.
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date