Possible .NET Framework 3.5 installation failure caused by broken MSXML registration

The .NET Framework 3.5 can fail to install on a system where MSXML is not properly registered.  There is a custom action that runs during .NET Framework 3.5 setup that tries to use some APIs in MSXML to modify some information in the web_mediumtrust.config file that is a part of the .NET Framework 2.0.  In the cases that we've seen of this issue so far, one of the MSXML CLSID values was somehow unregistered on the system, and that causes this custom action to fail.

How to diagnose this issue from the .NET Framework 3.5 setup log file

This issue will cause the following information to be written to the verbose MSI log file for the .NET Framework 3.5 component (named %temp%\dd_net_framework35_MSI*.txt):

MSI (s) (58:94) [11:11:11:829]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI35C6.tmp, Entrypoint: ExecXmlConfig
MSI (s) (58:F0) [11:11:11:829]: Generating random cookie.
MSI (s) (58:F0) [11:11:11:829]: Created Custom Action Server with PID 4936 (0x1348).
MSI (s) (58:74) [11:11:11:860]: Running as a service.
MSI (s) (58:00) [11:11:11:860]: Hello, I'm your 32bit Elevated custom action server.
ExecXmlConfig:  Error 0x80040154: failed to load XML file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web_mediumtrust.config
MSI (s) (58!50) [11:11:11:954]: Product: Microsoft .NET Framework 3.5 -- Error 25541.Failed to open XML file C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web_mediumtrust.config, system error: -2147221164

How to work around this issue

You can use one of the following options to work around this issue if you encounter it during .NET Framework 3.5 setup.  Note that these workarounds are only useful for this exact error and HRESULT value.  They will not help fix all possible .NET Framework 3.5 setup failures.

  1. Re-register msxml3.dll by running regsvr32 msxml3.dll
  2. Re-install MSXML3 by downloading and installing the package from https://www.microsoft.com/downloads/details.aspx?familyid=28494391-052b-42ff-9674-f752bdca9582

More details about the root cause of this issue

In the example log file above, the HRESULT value is 0x80040154, which means that a class is not registered.  On systems where we have seen this error, the root MSXML CLSID is listed in the registry at the following location:

[HKEY_CLASSES_ROOT\Msxml2.DOMDocument\CLSID]
@="{F6D90F11-9C73-11D3-B32E-00C04F990BB4}"

However, the following sub-key for this CLSID was not present on this system:

[HKEY_CLASSES_ROOT\CLSID\{F6D90F11-9C73-11D3-B32E-00C04F990BB4}]

The suggested workarounds listed above will re-register this CLSID, which has fixed this issue in the cases we have seen of this error so far.