Promoting all .Net Compact Framework Applications on a device using device.config

By default, a managed device application is run with the version of the .Net Compact Framework it was built with.  Only if that version is not present on the device will we "promote" the application to run with the latest installed version.  This policy is considered safe and conservative because it isolates applications from unintended compatibility changes that may be introduced in new version of the Framework, at least in the most common scenario.

However, there are times when you may want to run an application with a version of NetCF other than the one it was built with.  For example you may find that a newer version of NetCF performs better and is more stable than a previous version so you'd like to take advantage of those improvements without having to rebuild your application.  Several previous blog posts (see have shown how to do this using an application configuration file.  This approach is manageable as long as you only have a few applications to promote.  But if you'd like to promote a large number of applications it can quickly become a hassle to author all these configuration files and manage their deployment and updates.

Fortunately, version 3.5 of the Compact Framework lets you promote all applications on a device using a single device-wide configuration file.  The syntax of this configuration file is the same as that used in the application configuration file: you specify the version of NetCF you'd like to run all applications with using the supportedRuntime element.  The device-wide configuration file must be called device.config and must be located in the \windows directory.

Here's the contents of a sample device.config that will cause all applications to be run with .Net Compact Framework version 3.5:

        <supportedRuntime version="v3.5.7238"/>

There's one more case to consider.  Suppose you've used device.config to promote all your applications only to discover that one of your applications doesn't work properly.  In this scenario you'd want to "roll back" just that one application to the version it was built with.  You'd do this by authoring an application configuration file for that application.  Any supportedRuntime settings present in application configuration files will override the settings specified in device.config thus giving you a quick way to opt-out of your global policy.



This posting is provided "AS IS" with no warranties, and confers no rights.

Comments (1)

  1. The .Net Compact Framework 3.5 Power Toys include a new utility called the NetCF Configuration Tool.

Skip to main content