Windows Embedded CE6 R3 supports both .NET CF 2.0 and 3.5. Great you think, but Visual Studio 2005 debugger only supports .NET CF 2.0. This can lead to some very ambiguous behavior when trying to debug .NET CF applications on a CE6 R3 device.
Picture the following scenario. You have a Windows CE6 R3 device which includes .NET CF 3.5 runtime (CF 3.5 is backwards compatible with 2.0), but does not include the CAB installer, in the installed OS image. You develop a managed code application with Visual Studio 2005 and you build and deploy. Alas the deployment fails and you get an error something like:
—— Build started: Project: HelloWorld, Configuration: Debug Any CPU ——
HelloWorld -> C:SwiftInitialpHelloWorldHelloWorldbinDebugHelloWorld.exe
—— Deploy started: Project: HelloWorld, Configuration: Debug Any CPU ——
Deploying ‘C:Program FilesMicrosoft.NETSDKCompactFrameworkv2.0windowscewce500armv4iNETCFV2.wce5.armv4i.cab’
The system cannot find the file specified.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
Firstly the deployment error “The system cannot find the file specified” is a little misleading. This is not referring to the CAB file for .NET CF2 (NETCFV2.wce5.armv4i.cab) but to the CAB installer utility (wceload.exe), which it is expecting to find on the device. Obviously after deploying the .NET CF2 runtime to the device, the device needs to extract and install it, and it uses the CAB installer to do this (you also need .NET CF2 SP2 because you will get further additional errors without, see previous post Visual Studio 2005 deploy error after downloading a managed code application to a Windows CE6 R3 device ). The problem is that the OS on the device does not include the CAB installer. If you have the CE6 BSP for the device you could of course re-build the OS image and add the CAB installer from the catalog and that would fix the problem. Alternatively as a “hack” you could simply copy the CAB installer executable to the Windows directory of the device via ActiveSync before deploying.
However in theory this should not be necessary because the image on the device actually already contains the .NET CF3.5 run-time. In Visual Studio 2005 you can disable deployment of the .NET CF2 (Project -> Properties -> Devices), by de-selecting the option:
Since .NET CF3.5 is backwards compatible with CF2.0, this should do the trick, right? Unfortunately not. Although you will now successfully deploy the application, the Visual Studio 2005 debugger will fail to start it. This is because the debugger does not support CF3.5, only CF2.0. Of course if you do not want to actually debug the application you could simply copy the application executable to the device via ActiveSync and run it directly on the device. The better solution would be to install Visual Studio 2008 which does support .NET CF3.5 debugging.
So in summary the options are (in order of least effort):
1. Leave everything as is and copy the wceload.exe CAB installer (via ActiveSync) to the Windows directory of the device before deployment. You you may need to repeat this each time you power cycle the device since the Windows directory is often not persistent. This will give you full debugging capability. If you do not need debugging capability, you could simply copy the application itself to the device.
2. Install Visual Studio 2008 (for application development only, you will still need Visual Studio 2005 with PB for OS development, fortunately they can co-exist). Remember to disable deployment of the .NET CF in the Properties.
3. Re-build the CE6 image and include the CAB installer or exclude .NET CF3.5 and include .NET CF2.0. Remember you will ultimately need to do this anyway if you wish to include you driver in the image.
Whilst on the subject of .NET CF deployment, there is a good article on MSDN about creating a CAB installer for end users: