Freigeben über


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:

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

Comments

  • Anonymous
    August 03, 2004
    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.
  • Anonymous
    August 03, 2004
    The comment has been removed
  • Anonymous
    August 10, 2004
    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?

    Thanks,
    Mikal
  • Anonymous
    August 10, 2004
    Mikal,
    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
  • Anonymous
    August 11, 2004
    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?