How do I redistribute .NET CF with my CAB and install it when it’s not present on the device?


  • How do I redistribute .NET CF with my CAB and install it when it’s not present on the device?
    Tuesday, March 02, 2010 7:38 AM


  • To deploy your .NET Compact Framework application, you can either create device CAB files or create a desktop MSI package. The following article explains the two methods in detail:
    Deploying .NET Compact Framework 2.0 Applications with .cab and .msi Files

    Sometimes the target device does not have .NET CF installed, or the .NET CF on the device is not the desired version.  Instead of letting the user download and install .NET CF, you may want to package it along with your application. This can be done whether you use a desktop MSI file or device CAB files to deploy your application.

    If you use cab files to deploy your application, you can package the .NET CF cab files into a container cab. There is a sample named Multiple CAB Install in the Window Mobile 6 SDK. The sample shows you how to create one CAB file which contains multiple CAB files and install them one by one on the device. It makes use of a native setup.dll file to control the installation process, just as the custom actions when you create a MSI file. Please read the “MultiCab Whitepaper.doc” file in the sample’s folder for details.

    When you choose to deploy your application with a MSI file, you can install the container cab produced in the previous paragraph. You can also create a custom action BeforeInstall which will install .NET CF redistributable if the desired version of .NET CF is not present on the device.

    In either case you need a way to determine whether or not the device has the desired version of .NET CF installed. The information is stored in the registry key [HKEY_LOCAL_MACHINE\Software\Microsoft\.NETCompactFramework]. You can access the registry key using registry functions from setup.dll or using their RAPI versions from desktop.

    For more FAQs about .NET Compact Framework, please see .NET Compact Framework FAQ.
    Tuesday, March 02, 2010 7:44 AM