Friday, June 02, 2006

SDK's and Emulator for the Compact framework

I Mentioned earlier that there is no emulator available for the CF. But now there is. Microsoft has released the Mobile 5 Emulator as a standalone package. Here it is:
Standalone Device Emulator 1.0 with Windows Mobile OS Images.

After installing it you can run it like any other program from Programs in your Start Menu. The first time you start it, select PocketPC, Coldboot. Note that it will take almost a minute to boot for the first time, so be patient.
Unfortunately this version does not have the Compact Framework 2.0 installed, so we'll have to do that manually:
- First get the CompactFramework Installation file (NETCFSetupv2.msi)
- Make sure you have ActiveSync 4.0 or higher installed.
- Open the 'Device Emulator Manager' (it's in the same section of the Programs menu where you just started the PocketPC emulator). If the PocketPC emulator is running you will see it in the Device Manager screen as a button with a green arrow, followed by de Device ID.
- Select it, and open the Actions menu. Select 'Cradle'. This is the same as connecting an actual PocketPC to your PC by putting it in the cradle or docking station. Usually ActiveSync will now pop-up and connect, but if it does not, just open ActiveSync,and select 'File->Get Connected'.
The Emulator now behaves exactly like a real device connected through ActiveSync.
- Now start the Compact Framework Installation (just double click on the 'NETCFSetupv2.msi' file and the installation will start automatically. It will first extract the installation to your harddisk, then start up ActiveSync, and upload the installation to the emulator. The emulator will start the installation procedure.
Now pay attention : when the installation is finished on the emulator DO NOT LET IT RESTART. If you do, it will perform a coldboot, and your installation is gone. Select 'File->Save State and Exit' instead. The whole ROM image, including hte CF 2.0 installation will now be saved. Next time you start the emulator, start the 'PocketPC - Savestate' and you'll have a Compact Framework 2.0 enabled Pocket PC at your desktop.

What's also nice to have when developing is theWindows Mobile 5.0 SDK for Pocket PC.
This contains all kind of usefull samples, images, projects and also the Windows.WindowsMobile namespaces. Now when you try to install it you will notice it first checks for the presence of Visual Studio, and if that's not available, it refuses to install :-(
So we just have to unpack the .msi file using the
'LessMSIerable' utility from :-) I'm not 100% sure this is legal, but since it's so easy it would be foolish to forbid it.