How do I force my NetCF v1 application to run against NetCF v2?

In my “NetCF v2 now supports NTLM” post, I mentioned that the 3 ways to gain NTLM support with existing code are:

  1. Building your application against the v2 beta
  2. Uninstall v1 from your device (not possible on PPC 2003 devices, as v1 is installed in ROM)
  3. Construct an application configuration file for your executable, instructing it to run against the v2 beta

Option number 3 sparked a few questions.  Hopefully, this post will help answer those questions.

To force your NetCF v1 application to run against NetCF v2, whether or not v1 is installed on the device (either in RAM or ROM), all you need is a simple XML file in the following format:

    <supportedRuntime version=“v2.0.4135“/>

This file must be named as follows: <appname>.exe.config.  For example, if my executable is simpletest.exe, the name of the configuration file must be simpletest.exe.config.  Place the file in your application's folder on the device and you'll be running on NetCF v2.

Please note the last number in the version string.  This value must match the exact build number of NetCF v2 for this to work.  The value 4135 is the correct build number for NetCF v2 beta1.

One thing I like to do, to help me verify that I have created the configuration file correctly is to display the runtime version somewhere in my application (ex: the About box).  To do this, create a label control and assign the runtime version to the Text property as shown below:

runtimeVersionLabel.Text = System.Environment.Version.ToString()

If you do not see “2.0.4135“, you are not running against the NetCF v2 beta.  Most likely, this is due to a type-o in your configuration file or that the file cannot be located (copied to the wrong folder, misnamed, etc).

Hope this helps!

This posting is provided "AS IS" with no warranties, and confers no rights.
Some of the information contained within this post may be in relation to beta software.  Any and all details are subject to change.

Comments (7)

  1. Jerry Pisk says:

    How do I have my app to run with the newest (highest version number) framework installed? And I mean at all times, not just today, so when 3.0 is released it will run under 3.0.

  2. David Kline says:

    Jerry, Wildcards are not supported. The NetCF supportedRuntime feature mirrors that of the full framework (specific build numbers only). You can, however, list more than one supportedVersion element. I created the following sample listing two fictitious builds of NetCF. My application correctly falls back to v2.0.4135 since that is listed and installed on the device.



    <supportedRuntime version="v2.0.7766" />

    <supportedRuntime version="v2.0.5555" />

    <supportedRuntime version="v2.0.4135" />



    The following link is to the .NET Framework documentation related to the supportedRuntime element:

    — DK

  3. Heya,

    after installing the 2.0 beta SDK on my PC, and the runtime on my Ipaq, VS .NET 2003 can no longer debug the application. If I remove the config file so it can use the older version of the framework I can debug again.

    Is there are work around for this, apart from installing a beta of Visual Studio 2005?



  4. David Kline says:


    Visual Studio .NET 2003 only knows how to debug NetCF v1. If you use a configfile to force your application to run against NetCF v2, you will either need to debug using the Visual Studio 2005 beta or cordbg (from the v2 SDK beta).

    — DK

  5. bwed says:

    I want to use the System.Configuration namespace to get settings out of the app.config file and a smart device application does not seem to allow that… why not?

Skip to main content