Reflections on having multiple versions of NetCF on your device

Published 27 August 07 11:57 PM | andarno 

The .NET Compact Framework has had several releases: V1 + 3 service packs, V2 + 2 service packs, V3.5 (to date just betas).  Which of these are installed on your device?  Can you have multiple versions installed simultaneously?  Which version will run your NetCF app if multiple versions are installed?  This post addresses all these questions.

Can you have multiple versions installed simultaneously?

NetCF supports side-by-side installations for distinct versions only.  For example, V1 and V2 may be installed on your device at the same time, but V2 and V2 SP1 may not be installed at the same time.  After V3.5 is released, if a V3.6 were to come out it could be side-by-side installed with V3.5 since it is a distinct version.

If you have a version installed in ROM and a service pack version with the same major and minor numbers installed in RAM, only the version in RAM is actually installed and will run your application.

Discovering which version(s) of NetCF is installed on your device

To see what is installed on your device right now, you can click Start -> Settings -> System -> Remove Programs and see what's listed.

To find which version(s) are installed programmatically (say for a setup program you're writing), you can check the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETCompactFramework.  There are DWORD values under it named "X.Y.BBBB.mm" for each installed version of NetCF.  A value of 0 means it is installed in RAM while a value of 1 means it is installed in ROM.  Beware that if a version is in ROM (i.e. V1) and a newer build of the same version is installed in RAM (i.e. V1 SP3) then both of these will be listed as values in this registry key, although only the SP3 version will actually be present on the system.

[Added 11/29/2007] Check out Neil Cowburn's blog post that contains a table of version numbers and releases for NetCF.

Which NetCF version will run your app?

Review the flow chart or read the discussion below.

A device.config file in your \windows directory may force all applications to run against a particular version of NetCF on your device, although an app-specific .config file takes precedence.  In the absence of a device.config file (which is not present by default), the following rules apply.

If only one version of NetCF is installed on your device, it will run your app if it is at least as recent as the NetCF version that the application was built against.  So a V2 app will run on NetCF V2 and V3.5, but not on NetCF V1. 

Service packs are excluded from this check, so if an application is written against NetCF 2.0 SP2, NetCF 2.0 RTM and SP1 will also run the app.  If that app takes dependencies on SP2 bug fixes, the app may break when run on V2 RTM and should therefore check at startup time to see what version of NetCF is running it and warn the user if the appropriate service pack is not installed.  The System.Environment.Version property will allow you to check the NetCF version and service pack your app is running on.

If you have multiple versions of NetCF installed, a NetCF app will run against the version of NetCF it was compiled against if it is installed on the device.  If that version of NetCF is not installed, then the newest version of NetCF that is installed will be used.  For example, a V1 app run on a device with only V2 and V3.5 installed will run on V3.5.

You can alter the default behavior with a .config file to force your app to load with a specific version of NetCF.  For example, on a device with V2 and V3.5 installed, you can force the V1 app to run against V2 (rather than the newest V3.5) by using a .config file.  For details on this process, see the MSDN documentation How to: Configure Runtime Version.

Should you have multiple versions installed?

That depends on the applications you run and their requirements.  In theory, V2 SP2 should be able to run V1 apps because it has a "compatibility mode" that preserves old V1 behavior where needed by older apps.  V3.5 will offer the same backward compatibility feature.  But this "version coercion" feature is not perfect, and you may find that an app that runs on V1 won't run on V2.  In this case, installing V1 side-by-side with V2 is a good idea if you have memory on your device for it.

Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# .NET Compact Framework Team said on September 7, 2007 8:08 PM:

Andrew Arnott discusses which versions of the .NET Compact Framework can be side-by-side installed, and

# Avnsh said on May 13, 2008 6:50 PM:

I have the Microsoft Emulator for WM 6.1. But for some reason it comes with CF Version 2.0 SP2 installed in the ROM. I want to test my application on a fresh phone with WM 6.1 and CF 3.5 installed in the ROM. I did try to install the CF 3.5 on the Emulator, and all works fine, but as a true test I want to remove the CF 2.0 version from the ROM and replace the 3.5 version in ROM. Is that doable?

# Francois Jean said on August 5, 2008 11:08 AM:

Thank you for the article it is very helpful.

I have the following question about the version number:

I checked which version of .NET CF was installed on my PDA by looking at the registry key and I found this:

1.0.4292.0 (1)

1.0.4292.00 (0)

3.5.7283.00 (0)

My interpretation:

CF 1.0 SP 3 is installed in ROM and in RAM (maybe the RAM version is faster and it’s why they installed it).

Why the last number is sometimes “.0” or “.00”? Is there any difference between version “1.0.4292.0” and “1.0.4292.00”?

Leave a Comment

(required) 
(optional)
(required) 

Search

Go

This Blog

Interesting blogs

Related sites

Syndication

Page view tracker