Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

Possible issue where .NET Framework 4 setup reports success but fails to update mscoree.dll behind the scenes

Possible issue where .NET Framework 4 setup reports success but fails to update mscoree.dll behind the scenes

Rate This
  • Comments 13

I have heard from a few customers since the release of the .NET Framework 4 who have installed the .NET Framework 4 on Windows Vista or higher and setup reported success, but they see an error when running the .NET Framework setup verification tool.  I wanted to describe this scenario in a bit more detail, including how to diagnose whether or not your computer is running into this issue based on the setup log files.

How to quickly tell if this blog post might apply to you

Before reading this whole post, here is a quick way you can check whether or not you are likely to be encountering the issue described below:

  1. Your OS was Windows Vista, Windows Server 2008 or Windows 7.  This particular issue does not affect Windows XP or Windows Server 2003.
  2. You installed the .NET Framework 4 and setup reported success, but you cannot use .NET Framework 4 applications on your computer afterwards.
  3. The file %windir%\system32\mscoree.dll and/or %windir%\syswow64\mscoree.dll has a file version of 2.0.* instead of 4.0.* (and you have rebooted your computer after installing the .NET Framework 4 to make sure that any files that were in use during installation have had a chance to be updated).

Symptoms of the problem

In the cases I’ve seen so far, the .NET Framework setup verification tool reported an error like the following when it tried to run a .NET Framework test application that is bundled with it:

****ERROR**** Process 'Netfx40TestApplication.exe' exited with return code -2146232576

This return code translates to 0x800131700, which is a .NET Framework common language runtime (CLR) error code that means “Failed to load the runtime.”  In other words, this return code means that this version of the .NET Framework runtime failed to load at all on this computer.

Further investigation on the computers that exhibited this behavior showed that the file mscoree.dll (which is located in %windir%\system32 and/or %windir%\syswow64) had a version number of 2.0.*.  This file is shared by all versions of the .NET Framework, and it should always have a version of at least 4.0.* after installing the .NET Framework 4.  If this file is not updated to version 4.0.*, the CLR loader will be unable to load the .NET Framework 4, and it will cause the type of failure in the .NET Framework verification tool that I described above.

Gathering more detailed information from .NET Framework setup log files

I wasn’t sure how a computer could be in a state where .NET Framework 4 setup reported a successful installation but yet mscoree.dll was still versioned 2.0.*.  I had the customers use the instructions in this blog post to gather their .NET Framework setup log files, and I started looking at the logs to narrow this issue down further.

In the cases I’ve seen so far, I found an error like the following in the log file named Microsoft .NET Framework 4 Setup_*.html:

Exe (C:\Users\myusername\AppData\Local\Temp\Microsoft .NET Framework 4 Setup_4.0.30319\Windows6.1-KB958488-v6001-x64.msu) failed with 0x80240017 - (null).

The .msu file listed in the above error message is one of the ones that are responsible for updating mscoree.dll to version 4.0.* on Windows Vista and later versions of Windows.  Return code 0x80240017 means that the .msu file is not applicable on the computer it is being installed on.  This type of return code can occur for several different reasons:

  1. The .msu is for an earlier or later OS version or service pack level than what is currently on the computer
  2. The .msu is for a different processor architecture than the OS running on the computer
  3. The .msu is already installed
  4. The OS update installation engine is in a broken state that prevents the installation of any OS updates (.msu files)
  5. The OS is a pre-release version of Windows Vista, Windows Server 2008 or Windows 7.  See this blog post for more details about this case.

.NET Framework 4 setup prevents cases #1 and #2 from happening behind the scenes, but it cannot prevent cases #3, #4 or #5.  To complicate things further, it is not possible to reliably distinguish from this return code which of the cases is the actual cause of the return code.  Even worse, case #3 is a case that should be treated the same as a successful installation of this .msu as opposed to a failure.

As a result, the .NET Framework 4 setup ignores this error and treats it as a successful installation of this .msu (case #3).  This is why you will see information like the following later in the log file:

Error 0x80240017 is mapped to Custom Error: Success

Narrowing down the root cause based on the log files

Because mscoree.dll was not updated like it should have been on the affected computers, I made an educated guess that the customers who contacted me were running into case #4 on their computers.  I was able to confirm this in the following ways:

  1. Looking at the log files named %windir%\WindowsUpdate.log and %windir%\logs\cbs\cbs.log (both of which are collected by the log collection tool linked above).  In the cases I’ve seen so far, one or both of these logs showed errors while trying to evaluate applicability and/or install OS updates.  These errors affected the .NET Framework 4 .msu file as well as other OS updates that the customer had attempted to install.
  2. Trying to manually install an OS update from Windows Update or by downloading it and running it directly.  In the cases I’ve seen so far, attempting to install any OS update failed just like the .NET Framework 4 .msu file failed.

Possible solutions for this type of error

  1. In some cases, it can help to run SFC to repair the files that are installed as a part of Windows.  You can find steps that explain how to do this in this knowledge base article.

  2. If SFC does not help, the System Update Readiness Tool might help repair the computer so that OS updates will install again.  I’ve posted a set of steps I’ve had success using with this tool in some cases in the past in this blog post.

  3. Peter Marcu has posted a few additional suggestions on his blog for this type of issue as well.

  4. Unfortunately, if the above suggestions do not help, the only other way that I've found to solve this type of OS update installation error is to repair Windows. 

<update date="12/30/2010"> Added a note about pre-release versions of Windows causing this error as well. </update>

<update date="7/27/2011"> Added a note about using SFC to repair Windows files, as suggested in Peter Marcu's blog. </update>

<update date="11/8/2011"> Added a direct link to Peter Marcu's blog post about this issue. </update>

<update date="6/6/2012"> Fixed broken link in the "Gathering more detailed information" section. </update>

 

  • Have you looked at this posting as a possible answer?  Thanks for your post... I just tackled this issue again after a year of frustration yesterday.  The timing was perfect!

    social.msdn.microsoft.com/.../150d05c4-4df4-47ec-b7a6-a66f3a55cd08

  • Hi Cmaerzluft - Thanks for the link to that forum post.  It does look like the same underlying problem as the one described in this blog post.  Hopefully you'll have good luck repairing the OS update install engine on your computer so that you can successfully install the .NET Framework 4.  I'm very sorry for all of the hassles that this issue has caused for you in the meantime though.

  • It was indeed the version of the operating system that was the issue. I was still using the RTM-iso I downloaded from the msdn-section. After a reinstall with the latest version I could download, no more problems where detected with .NET v4.

  • Can someone please post the solution? The article on MSDN forums isn't there anymore :(

  • Hi Eric - Which MSDN article are you referring to?  I just tried all of the links in this blog post and they all seem to be working correctly for me.

    There isn't one single solution that will work in all cases for this issue other than to repair/re-install Windows.  There are some other workarounds that might allow you to fix this issue without needing to re-install Windows (such as the System Update Readiness Tool).

  • Can you just copy over the v2 mscoree.dll with the v4 mscoree.dll to fix this problem?

  • Hi Dan - I think that you can do that as as a temporary workaround for this type of issue.  However, in the cases I've seen so far, the root cause was that all OS updates failed to install on the computer.  It is better to try to fix that root cause because otherwise you could end up missing critical security updates in the future.

  • Thanks for the reply Aaron. I shared this with one of my users who was having the problem and couldn't run my software (a .NET 4 based gravity simulator). I figured out the million step procedure to replace the mscoree.dll files, and they reported that it fixed their problem and allowed them to run it.

    Here's the procedure to fix this problem:

    universesandbox.com/.../topic,3724.msg36107.html

  • Hi Dan - Thanks for the link.  This set of steps looks reasonable to replace mscoree.dll, but this is still only treating a symptom (can't update mscoree.dll for the .NET Framework 4) instead of the root cause (can't install OS updates).  I think that computers in this state are going to run into other issues later on because they won't be able to apply security updates, etc.

  • bro the universal sandbox link is not working

  • Hi Robozilla - The only broken link I found in this post was in step 5 in the "Gathering more detailed information" section, and I've fixed that.  Was that the link you were referring to?

  • how do you download mscoree4

  • Hi gan-erdene - Mscoree.dll is a file that is a part of the .NET Framework.  You can't download it by itself.  Are you currently experiencing a .NET Framework setup error?  If so, can you please provide more details about what kind of error that you're seeing so I can see if I can help?

Page 1 of 1 (13 items)
Leave a Comment
  • Please add 6 and 8 and type the answer here:
  • Post