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:

<configuration>
  <startup>
    <supportedRuntime version=“v2.0.4135“/>
  </startup>
</configuration>

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!
--DK

Disclaimers:
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.