Prerequisites
- Visual Studio .NET 2003
- SDK for Windows Mobile 2003-based Smartphones
- Your smartphone (the tests were made on an Orange SPV C500 Smartphone) with Windows Mobile 2003 SE
- Microsoft ActiveSync 3.8
Short Foreword
Like Steve Ballmer said in a Channel 9 interview, in the future we will see more mobile applications (focus on the smartphones), mainly because since now the mobile phones were dumb. In my opinion, Microsoft saw the opportunity to conquer a new market, the mobile one, with the software that took the company in the top of the software makers, Microsoft Windows, this time named Microsoft Windows Mobile (actually a customized Windows CE). I'm very glad they chose to make this move.)
As I am a big fan of .NET Framework, as soon as I got my Orange SPV C500 smartphone, I got glued to it. :) And "the glue" made me more enthusiastic about .NET Compact Framework. I think that a smartphone can be smarter only if you make it so ... by deploying your own applications on it.
Enough Talking… We've Got Things To Do
This article is not intended to show you how to work with the .NET Compact Framework, but instead, it will show you (step by step) how to deploy an application that you have already written (using .NET Compact Framework), on your Smartphone. Keeping this in mind, we will use for deployment, the Sliderpuzzle example, that came with the Microsoft Smartphone 2003 SDK.
Follow the White Rabbit ;)
1.
Please check that you have this example located on
C:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Samples\Managed\Sliderpuzzle
or in whatever other place, you have installed the SDK.
2.
Open the solution file with VS .NET 2003 and set the version to Release
(from the Build\Configuration Manager menu).
3.
Try to build the .cab file, using the VS.2003 Build\Build Cab File menu.
3.1.
My guess is that you will get an error, at the end of the building process, an error that will sound like this one:
Error : The CabWiz executable 'C:\Program Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows CE\Smartphone\..\bin\..\bin\cabwiz.exe' could not be invoked
3.2.
After the error message you will get informed about the creation of the BuildCab.bat file.
Creating batch file 'C:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003 \Samples\Managed\Sliderpuzzle\obj\Release\BuildCab.bat' for command line build
This is good news, but let's dig to solve the error…
3.3.
Open the .bat mentioned file with your favorite editor. You will see that it wants to use a .exe file that doesn't exist. Replace the line
C:\Program Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows CE\Smartphone\..\bin\..\bin\cabwiz.exewith
C:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Tools\CabwizSP.exetaking care to keep the specified parameters.
After the 3.3 intermediate step, BuildCab.dat will have the following content (except the --- markers):
---
"C:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Tools\CabwizSP.exe" "C:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Samples\Managed\Sliderpuzzle\obj\Release\SliderPuzzle_SMP.inf" /dest "C:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Samples\Managed\Sliderpuzzle\cab\Release" /err CabWiz.SMP.log /cpu ARMV4 X86---
Let's take a closer look to what's happening there:
"C:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Tools\CabwizSP.exe"(this is the .exe file used to generate the .cab file)
"C:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Samples\Managed\Sliderpuzzle\obj\Release\SliderPuzzle_SMP.inf" (contains metadata information, other information about where to install your application on the device and which shortcuts to create, so a user can use the application)
/dest "C:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Samples\Managed\Sliderpuzzle\cab\Release" (the target directory that will contain the .cab file)
/err CabWiz.SMP.log (the specified file will contain the possible generated errors)
/cpu ARMV4 X86 (a .cab file will be generated for each type of specified processor)
3.4.
Copy this file
C:\Program Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows CE\wce400\x86\vsd_setup.dllin the following directory
C:\Program Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows CE\Smartphone\wce400\x86
3.5.
Copy this file
C:\Program Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows CE\wce400\armv4\vsd_setup.dllin the following directory
C:\Program Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows CE\Smartphone\wce400\armv4
4.
Launch
BuildCab.bat. The result will be found in
C:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Samples\Managed\Sliderpuzzle\cab\Release\SliderPuzzle_SMP.ARMV4.CAB.
4.1.
Next to it, we will find
CabWiz.SMP.log file, where you will probably find a couple of warnings.
My file, for example, contains the following lines:
---
Warning: Section [DefaultInstall] key "AddReg" - there are no section entries to process
Warning: Section [DestinationDirs] key "Shortcuts" is not using the string "%InstallDir%"
Warning: Section [DestinationDirs] key "Files.X86" is not a valid file list
Warning: Section [DefaultInstall] key "AddReg" - there are no section entries to process
Warning: Section [DefaultInstall] key "AddReg" - there are no section entries to process
Warning: Section [DestinationDirs] key "Shortcuts" is not using the string "%InstallDir%"
Warning: Section [DestinationDirs] key "Files.ARMV4" is not a valid file list
Warning: Section [DefaultInstall] key "AddReg" - there are no section entries to process---
These warnings are related to some of the options specified in the .inf file. You can remove the sections that you don't need, so there will be no more warnings.
5.
If you managed to stay in touch with the article by this point, the reward will be the deployment itself. ;)
5.1.
Get connected to your smartphone using Microsoft ActiveSync and press the
Explore button. ;)
5.2.
Copy this file
C:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Samples\Managed\Sliderpuzzle\cab\Release\SliderPuzzle_SMP.ARMV4.CAB into the following directory
\Storage\windows\Start Menu\Accessories (on your smartphone).
6.
Now "press the buttons of your smartphone".
6.1.
Start\More\More\Accessories\ and launch
SliderPuzzle_SMP.ARMV4.CAB.
6.2.
You will probably get
"Download completed successfully", and you will be asked to specify where you want your application to be installed: on the
Phone or on
\Storage Card.
I'll select the first option, since my MiniSD card is already full (it's still the default one, 16MB).
Press
Done after that.
After a couple of seconds, you will be informed upon the success or in success of your operation (
SliderPuzzle_SMP.ARMV4.CAB was successfully installed on your device).
6.3.
If your eyes are fast enough you will see that the .cab file is now missing. Why?
Because it is erased by default, after the installing operation. If you want to keep your .cab file, set the Read Only permission, before you copy it on your smartphone.
7.
Start the new game, by pressing Start\More\More\SliderPuzzle. Have fun! ;)
In case that you get bored by an application, read the next step. ;)
8.
Start Microsoft ActiveSync.
8.1.
Use the
Add\Remove programs... option from the
Tools menu. ActiveSync will connect to the smartphone and it will show you all
YOUR installed applications.
In the
Add\Remove programs... window, instead of a company name, you saw "My Company". To specify a company name, modify the
SliderPuzzle_SMP.inf file.
You can find the .inf file sections explained with a lot of details, in the Smartphone 2003 SDK Help.
8.2.
Just select the application that you want to uninstall and press the
Remove button.
Well… that's it. See you soon with another article... ;)