How to: Configure Runtime VersionĀ 

You can force an application built with .NET Compact Framework version 1.0 to run on a device installed with .NET Compact Framework version 2.0. The feature is identical to the mechanism for forcing applications in the full .NET Framework to run on the newer version. The .NET Compact Framework provides two settings:

  • supportedRuntime

    Specifies the runtime version of the .NET Compact Framework for the application to use.

  • compatibilityversion

    Specifies the compatibility mode for a specified version. Note that you should only use this setting for diagnostic purposes.

You can also use programmatically use Environment to determine the version.

To determine the currently installed version

  1. On the Pocket PC, use File Explorer to navigate to the Windows directory and tap the cgacutil file.

  2. A message box appears with the version of the .NET Compact Framework installed on the device.

To set an application to run on version 2

  1. Determine the version number of the .NET Compact Framework running on the device. The version number used in this configuration does not include the last period and trailing zeros in the number. For example, "Version 2.0.50610.0" as returned from cgacutil should be "v2.0.50610" in the configuration.

  2. Create a text file with a file name that has ".exe.config" appended to the name of the application, for example, "appname.exe.config".

  3. Add the XML node as shown here to the file with the correct version number for version 2:

    <configuration>
      <startup>
        <supportedRuntime version="v2.0.50610"/>
      </startup>
    </configuration>
    
  4. Save the file to the folder that contains the application.

  5. Run the application.

NoteNote

The version number for the .NET Compact Framework 2.0 is subject to change before the final release.

To set an application to run on version 2 with compatibility for version 1

  1. Create a text file with a file name that has ".exe.config" appended to the name of the application, for example, "appname.exe.config".

  2. Add the XML node as shown here to the file with the correct version number for version 2:

    <configuration>
      <runtime>
        <compatibilityversion major="1" minor="0"/>
      </runtime>  <startup>
        <supportedRuntime version="v2.0.3600"/>
       </startup>
    </configuration>
    
  3. Save the file to the folder that contains the application.

  4. Run the application.

See Also

Other Resources

Building Applications and Core Tasks