Possible issue installing the .NET Framework 3.5 on an XP Embedded image that includes the .NET Framework 2.0

Recently, a customer contacted me with a question about a .NET Framework 3.5 installation error they were running into on a Windows XP Embedded runtime image.  I worked with the XP Embedded team to post more details about the cause of this issue and how to work around it in this item on the Embedded team blog, but I also wanted to mention it here as well in order to hopefully make it easier to find in the future.

Description of the issue

The customer who contacted me has a Windows XP Embedded image that contains the .NET Framework 2.0 Windows XP Embedded component.  When they attempt to run .NET Framework 3.5 setup on this image, it displays the following error and then fails:

Microsoft .NET Framework 2.0 Service Pack 1 -- Setup has determined that this version of .NET Framework is part of your operating system and cannot be installed or uninstalled with this setup. Use Windows Update for all future updates to .NET Framework. Setup will now exit.

Behind the scenes, the .NET Framework 3.5 installer is trying to install the .NET Framework 2.0 SP1 MSI package. The .NET Framework 2.0 SP1 MSI contains logic to block it from installing when it detects that the .NET Framework 2.0 was installed as an OS component, and that causes this error dialog to appear.  When using the .NET Framework 2.0 component for Windows XP Embedded, the .NET Framework 2.0 is treated as an OS component and cannot be updated using MSI-based installers.

How to work around the issue

If you have a Windows XP Embedded runtime with the .NET Framework 2.0 component included, and you need to install the .NET Framework 3.5 on the image after it has been deployed, you can work around this blocking dialog by removing the following registry value from your runtime:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727]
OCM=1

When doing this, it is important to note that the .NET Framework 3.5 has additional dependencies that were not needed for the .NET Framework 2.0. Even after removing this registry value, you may run into errors during .NET Framework 3.5 installation if your Windows XP Embedded runtime image does not include these dependencies.  If you have included the dependencies required for the .NET Framework 3.0 into your runtime image (described in this blog post), then you should be able to install the .NET Framework 3.5 as well.