Share via


Developing .NET Compact Framework applications for Windows CE 4.2 Devices.

.NET Compact Framework v2.0 SP1 includes support for Windows CE 4.2 based devices.  To date, Visual Studio 2005 does not provide managed 4.2 projects nor is there any support offerings for developing solutions targeted at 4.2 devices.  The good news is the 5.0 projects work just fine with one exception, debugging is currently broken on x86 based devices.  Below I outline the steps in creating and debugging a .NET Compact Framework v2.0 SP1 Hello World application.

Using Visual Studio

The steps below outline how to create and debug a hello world application using Visual Studio 2005.  If your Windows CE device uses an x86 processor, see Using Command Line section.

1. Configuring the Development Environment

To successfully run and debug applications based on  .NET Compact Framework 2.0 SP1 you will need to apply .NET Compact Framework 2.0 SP1 to your development environment.  To update Visual Studio 2005 download the latest .NET Compact Framework 2.0 SP1 patch from https://www.microsoft.com/downloads/details.aspx?FamilyID=7befd787-9b5e-40c6-8d10-d3a43e5856b2&displaylang=en

2. Creating the Hello World Project

  1. Open Visual Studio 2005 and create a new C# Windows CE 5.0 project by selecting Device Application from the New Project dialog.
  2. From the ToolBox drop a button on the form and add code below
  3. Add Code to button click MessageBox.Show("Hello World");
  4. The Windows CE 5.0 project will attempt to deploy the .NET Compact Framework 2.0 SP1 CAB files which are not designed for Windows CE 4.2.  To disable deployment turn off Deploy the latest version of NETCF click on your projects properties by selecting the Property Menu and clicking on Properties.  Then click on the Devices tab and uncheck Deploy the latest version of the .NET Compact Framework.
  5. Build the Hello World application by selecting Build Solution under the Build menu.

3. Setting up the Device

There are two ways to get NETCF v2 SP1 included on your 4.2 device, included in ROM by building ROM images using Platform Builder 4.2 or installed into RAM by deploying the .NET Compact Framework CAB file.  See below for details

Including .NET Compact Framework v2.0 sp1 in ROM

  1. On the PC that includes Platform Builder apply the .NET Compact Framework 2.0 SP1 Update.  For more information on the Platform Builder Update, see Windows CE Download Center
  2. Once the Update is applied, open the Workspace which contains the image to be updated. 
  3. Remove .NET Compact Framework v1 from the list of included features
  4. Add .NET Compact Framework v2.0 SP1 from the Catalog.

Including .NET Compact Framework v2.0 sp1 in RAM

  1. Copy the matching CAB file from \Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v2.0\WindowsCE\wce400\<<Processor>>\NETCFv2.wce4.<<proc>>.cab to your device
  2. Run CAB file on the device to install.

4. Connecting the Device to Visual Studio 2005

If your device connects to the PC using ActiveSync then make that connection now.  To connect a WindowsCE device to Visual Studio 2005 without ActiveSync see:  https://msdn2.microsoft.com/en-us/library/ms228708.aspx

5. Deploy and Debug Hello World

  1. In your Hello World application set a breakpoint at the messagebox.
  2. Type F5 to deploy.
  3. The code will stop at the breakpoint, type F5 again to continue to run the project.

Using Command Line To Debug

For x86 based devices, debugging will need to be done from the command line using mdbg.  For more information on command line debugging see David Klines blog posting at: https://blogs.msdn.com/davidklinems/archive/2006/07/13/665023.aspx

Comments