Creating Applications for the Pocket PC, Page 2
Deploying Your Applications
You've created that application and done the whole testing thing. Now you're ready to roll it out to .NET CF devices around the globe. What's to do?
First, as with regular Windows applications built for the full .NET Framework, a copy of the framework needs to be installed on the machine. This can be installed in RAM by downloading the setup from http://msdn.microsoft.com/vstudio/device/golive.asp. This is absolutely required: attempting to run a smart device application without the .NET CF installed will raise an error.
TOP TIP Today, most devices will allow the .NET Compact Framework to be installed only into RAM. However, most future Pocket PCs and smart phone devices will come with the .NET Compact Framework already installed in the ROM.
Second, you need to create your application setup. This is fully automated: simply select Build > Build Cab File from within your smart device application project.
TOP TIP If you wish to distribute a bundle of files with your application (game images, for example), add them by right-clicking on your project and selecting Add > Existing Item. You can also put files within subfolders. When installed on the device, the folders and files are extracted in the application root directory, ready for your application to utilize.
Inside your project \Cab\<Configuration>\ folder, you'll find a variety of CAB files (alongside a mass of unimportant DAT files, which you may disregard). Each of these CAB files contains a version of your project specific to a particular processor for the platform you selected. For example, a Pocket PC application will generate versions for the ARM, X86, MIPS, and other processors.
However, as all Pocket PC devices are now standardizing on the ARM v4 processor, the most important CAB file in the list is MyProject_PPC.ARMV4.CAB. This is your project setup, created for the Pocket PC (PPC) ARM v4 processor.
When you're ready to deploy, you can deploy the relevant CAB to your device using ActiveSync (a PC-device synchronization feature that many PDA users will be aware of) or by setting up a file share on your machine, copying the CAB file onto your device, then single-clicking to automatically install.
TOP TIP Want to test CAB deployment on the Pocket PC 2002 emulator? You can simply set up a file share, then copy the CAB file across the emulator ROM, and run! Here's how: first, create a folder containing the CAB file, then set it up as a shared directory (typically, right-click, select Sharing and Security, select "Share this folder", and then click on OK). Next, in your Visual Studio .NET device project, select Tools > Connect to Device. The emulator should appear in the background. On the emulator, select Start > Programs > File Explorer, then click on the network share icon at the bottom-middle of the screen. You should be prompted for the name of your machine (\\MyComputerName), followed by your user name, password, and domain (if required). Open the shared folder, and then click and hold on your CAB file as a series of dots draw themselves on the screen: eventually, a popup menu will appear. Select Copy. Next, switch back to browsing files on your device by clicking on the PDA-style icon at the bottom of the screen. Now select Edit > Paste, and your CAB will be copied to the local machine. (This is required because networked files will not open over the network.) When copying has finished, single-click on the CAB to begin installation. If you receive a naming conflict error when connecting to your file share, it's because you're running on the same machine that you're connecting to. So, click on Start > Settings, select the System tab, click on About, select the Device ID tab, change the Device name, and try again.
You'd be forgiven for thinking the deployment portion of such smart device applications is currently a little immature. It was, apparently, something of an afterthought. You can expect improvements in the next revision (see msdn.microsoft.com/vstudio/device for the latest). Don't be surprised to find a bundle of third-party InstallShield-style solutions to hit the market shortly, too.
Going on from Here
Although this brief introduction should give you enough fuel to get going with your own PDA applications, there's much more to learn.
For example, did you know that you can run the powerful SQL Server CE on your handheld? And you can write applications to create databases and access your data, perhaps even synchronizing live with a master SQL Server database? It's all true. (Check out the setup and help files in \Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows CE for more information.)
You can learn more about creating your own smart device applications by browsing the hidden samples distributed with Visual Studio .NET; they're in the \Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows CE\Samples\VB\ folder or online at www.gotdotnet.com/team/netcf/Samples.aspx. (Make sure you check out the MapPoint and Cave Man Hank samples!)
And, of course, there are a plethora of books dedicated to the technology: try The Definitive Guide to the .NET Compact Framework by Dan Fergus and Larry Roof ($59.99, ISBN 1-59059-095-3) and SQL Server CE Database Development with the .NET Compact Framework by Rob Tiffany ($44.99, ISBN 1-59059-119-4).
But, for now, go and create. The shift is simple, and the results are pretty amazing.
About the Author
Karl Moore (MCSD, MVP) is an experience author living in Yorkshire, England. He is author of numerous technology books, including the new "Ultimate VB .NET and ASP.NET Code Book" (ISBN 1-59059-106-2, $49.99), plus regularly features at industry conferences and on BBC radio. Moore also runs his own creative consultancy, White Cliff Computing Ltd. Visit his official Web site at www.karlmoore.com.
# # #