Now let us see how to deploy it on Windows Mobile Device. For deploying the application on device you need to have ActiveSync installed.
There are two ways in which application can be deployed on to the device. First option is to connect the device to the Development machine via USB. ActiveSync will automatically detect it and you can click on on the top bar. And this time select option “Windows Mobile 6 Professional Device”.
But then this approach is useful when you want to test/deploy and use the application yourself. What if you want to distribute it to others? In that case you need to create an installation program for your Windows mobile application. The installation file in the Windows Mobile world is distributed in the form of a CAB file. So once we have done with application we should opt for option 2 of creating a CAB file (A CAB file is a library of compressed files stored as a single file).
Creating CAB File
Creating a CAB file itself is a new project. To create CAB project right click on the solution and select the option New Project as shown below.
Clicking on New Project option will open Add New Project Wizard. Select option Setup and Deployment under Other Project Types on the left hand menu. Then select option Smart Device CAB Project on right hand side as shown below. We have named this project as MyFirstAppCAB.
Click OK and MyFirstAppCAB project is created under the solution a shown.
Now to add files to the CAB, right click on the Application Folder under File System on Target Machine and select option Add-> Project Output as shown.
On selecting Project Output option, the following screen will popup. Depending upon the requirement, select what all needs to be compressed in CAB file. For this example we require only output, hence will select option Primary output.
Now right click on CAB project MyFirstAppCAB and select option Build.
CAB file with name MyFirstAppCAB will be created at the location MyFirstAppMyFirstAppCABDebug.
Now let us see how we can deploy this CAB file on emulator and run the application. Click on Tools on the top bar and select option Device Emulator Manager.
This will open a Device Emulator Manager as shown below. Select option Windows Mobile 6 Classic Emulator. Right click and select option Connect.
Windows Mobile Emulator will start and on Device Emulator Manager you can see to left of Windows Mobile 6 Classic Emulator as shown below.
Next step is to Cradle.
If you are attempting to cradle for the 1st time, then you need to setup ActiveSync. To setup ActiveSync, double click on on right bottom on Task bar. Microsoft ActiveSync will open up, select option File -> Connection Settings as shown in figure below.
Connection Settings window will be open up as shown below. Check the option Allow Connections to one of the followings and then from the drop down select the option DMA.
After connecting Windows Mobile 6 Classic Emulator using Device Emulator Manager, again right click and select option Cradle as shown below. Cradle will start ActiveSync and make Emulator work as device connected using ActiveSync.
On successful connection you can see on the left of option Windows Mobile 6 Classic Emulator on Device Emulator Manager as shown.