Is your application running on version 2 of the .NET Compact Framework?

Now that version 2 of the .NET Compact Framework has been released and Visual Studio 2005 has been launched, I thought it would be a good idea to post an update to the application configuration (app.config) file needed to allow your .NET Compact Framework v1 applications to enjoy the benefits of the new release.

To promote your v1 applications to run on version 2 of the .NET Compact Framework,:

  1. Copy the following XML data
    <configuration>   <startup>     <supportedRuntime version="v2.0.5238"/>     <supportedRuntime version="v1.0.4292"/>     <supportedRuntime version="v1.0.3316"/>     <supportedRuntime version="v1.0.3111"/>     <supportedRuntime version="v1.0.2268"/>   </startup> </configuration>
  2. Create a file called <appname>.exe.config (ex: WebCrawler.exe.config) containing the above XML
  3. Save a copy of the file in the folder (on your device) containing your application (ex: \Program Files\Web Crawler)

By default, the .NET Compact Framework will run your application on the version of the runtime for which it was originally written.  Currently available (at the time of this writing) Windows Mobile 2003 and Windows Mobile 5.0 devices contain version 1 of the .NET Compact Framework in ROM.  Installing version 2 of the .NET Compact Framework does not overwrite or disable version 1.  In this scenario, your applications written for version 1 will continue to use version 1.

The addition of an application configuration file containing the above mentioned data will instruct the .NET Compact Framework to run your application with the specified version (version 2) of the runtime.  Your application will now take advantage of the performance improvements we have made in version 2 of the .NET Compact Framework.  Please note that since version 1 of the .NET Compact Framework is not aware of application configuration files, having one present on a device without version 2 installed has no affect on your application, it will continue to run with version 1.

While version 1 of the .NET Compact Framework is not application configuration file aware, installing and uninstalling version 2, on a device with version 1, will add configuration file awareness (via the updated mscoree.dll).  This is why the above data contains references to all .NET Compact Framework versions (v1, v1 SP1, v1 SP2, v1 SP3 and v2).

Compatibility is a primary goal for the .NET Compact Framework team.  If you encounter any issues running your version 1 applications using the above described application configuration file, please let us know via the Microsoft Product Feedback Center.

Take care,
-- DK

Disclaimer(s):
This posting is provided "AS IS" with no warranties, and confers no rights.

[Edit: add version 1 information to config file data]