.Net Framework 4.0 setup fails with the below error message:
"Failed to install assembly 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.ServiceModel.Discovery.dll' because of system error: The system cannot find the file specified."


From the .Net Framework install log,

[7/5/2012, 13:52:23] Action: Performing Action on Exe at D:\9db060b2f8108fa10a9d8699257d\Windows6.1-KB958488-v6001-x64.msu...
[7/5/2012, 13:52:23]Launching CreateProcess with command line = wusa.exe "D:\9db060b2f8108fa10a9d8699257d\Windows6.1-KB958488-v6001-x64.msu" /quiet /norestart
[7/5/2012, 13:52:31]Exe (D:\9db060b2f8108fa10a9d8699257d\Windows6.1-KB958488-v6001-x64.msu) failed with 0x240006 - (null).
[7/5/2012, 13:52:31]PerformOperation on exe returned exit code 2359302 (translates to HRESULT = 0x240006)

…………………………………………….

…………………………………………….

…………………………………………….
07/05/12 13:56:04 DDSet_Status: Loading C:\Windows\Microsoft.NET\Framework\v4.0.30319\fusion.dll
07/05/12 13:56:04 DDSet_Error: Failed to install assembly C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.ServiceModel.Discovery.dll. IAssemblyCache->InstallAssembly() returned -2147024894.
07/05/12 13:56:04 DDSet_Error: Failed to install assembly 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.ServiceModel.Discovery.dll' because of system error: The system cannot find the file specified.

 

Resolution:

The install fails with error code  -2147024894 = ERROR_FILE_NOT_FOUND.  I captured a process monitor trace and found the following suspicious entries right before what looks to be the failure traces.

 "2:48:24.7410248 PM","MsiExec.exe","1712","RegEnumKey","HKLM\SOFTWARE\Microsoft\Fusion\NativeImagesIndex\v4.0.30319_32\IL\3e0d252d","SUCCESS","Index: 1, Name: 37Þ2a969"

"2:48:24.7410557 PM","MsiExec.exe","1712","RegQueryKey","HKLM\SOFTWARE\Microsoft\Fusion\NativeImagesIndex\v4.0.30319_32\IL\3e0d252d","SUCCESS","Query: HandleTags, HandleTags: 0x100"

"2:48:24.7410776 PM","MsiExec.exe","1712","RegOpenKey","HKLM\SOFTWARE\Microsoft\Fusion\NativeImagesIndex\v4.0.30319_32\IL\3e0d252d\37Þ2a969","NAME NOT FOUND","Desired Access: Read"

The values here should be hex encoded DWORDs.  The presence of the thorn character (‘Þ’) appears to be registry corruption which might result in this error from Fusion. The best approach would be deleting/renaming the HKLM\SOFTWARE\Microsoft\Fusion\NativeImagesIndex\v4.0.30319_32 tree first and then run the .Net Framework 4.0 setup. Also take a backup of the registry before deleting it.