Error 0x80131702 when installing .Net framework 2.0 Redist

The other day I encounter a problem when installing .Net framework 2.0 redist. It is a fresh install on a clean Windows XPSP2 machine.

During the install, setup pops up a dialog says LoadLibraryShim failed to locate fusion.dll, hr=0x80131702.

From CorError.h (in you .Net framework SDK include directory):

#define CLR_E_SHIM_INSTALLROOT EMAKEHR(0x1702) // Install root is not defined

The error means mscoree cannot find where the installroot is.

InstallRoot is a registry value of type REG_SZ in HKLM\Software\Microsoft\.NetFramework. It usually points to "%windir%\Microsoft.Net\Framework" in x86 and "%windir%\Microsoft.Net\Framework64" in x64/ia64 (replace %windir% with your real Windows directory.)

After I added the InstallRoot registry, the setup can be resumed and finished successfully.