Aaron Stebner's WebLog

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

How to repair the .NET Framework 2.0 and 3.0 on Windows Vista

How to repair the .NET Framework 2.0 and 3.0 on Windows Vista

Rate This

NOTE - this blog post was originally written for the .NET Framework 2.0 and 3.0 on Windows Vista.  Since then, Windows 7 has shipped, and it includes the .NET Framework 2.0, 3.0 and 3.5 as OS components.  The steps in this blog post apply equally to Windows 7 as well. 

Since the Windows Vista public launch in January 2007, I have been receiving questions about how to repair the .NET Framework 2.0 and 3.0 to try to resolve various bugs.  As I previously described here, the 2.0 and 3.0 versions are installed as OS components on Windows Vista and do not appear in the Programs and Features (formerly known as Add/Remove Programs) control panel.

Many of the customers I have heard from have tried to use the .NET Framework cleanup tool, but it does not list the .NET Framework 2.0 as a valid removal option when it is run on Windows Vista.  This is by design - the cleanup tool does not offer the option to remove any version of the .NET Framework that is an OS component on the OS it is being run on.

Windows Vista OS files and registry information (including those that are a part of the .NET Framework 2.0 and 3.0) are protected by Windows Resource Protection (WRP) in Windows Vista.  This means that only the OS installer service (named TrustedInstaller) has permission to modify/remove these files or registry keys unless you specifically take ownership of the files/keys and add additional user accounts to the access permission list (which you should not need to do except in extraordinary circumstances).

If you run into problems using .NET Framework applications on Windows Vista, and you suspect that files or registry entries that are a part of the .NET Framework 2.0 or 3.0 are corrupt, you can use the instructions listed below to attempt to repair them.

Repairing .NET Framework 2.0/3.0 files on Windows Vista

You can use the following steps to repair the files that are a part of the .NET Framework 2.0 and 3.0 on Windows Vista and Windows Server 2008:

  1. Click on the Start menu, choose All Programs, then Accessories, then right-click on the Command Prompt item and select Run as administrator
  2. Click Continue to authorize opening a command prompt with administrative privileges
  3. Run this command in the cmd prompt: sfc /scannow
  4. The cmd prompt should list text stating "Beginning system scan. This process will take some time."
  5. Wait for the scan to complete (this can take several minutes so be patient).  This command will scan all protected system files and replace incorrect versions with correct Microsoft versions
  6. When the scan completes, the SFC tool will indicate whether or not it found any problems and whether or not it was able to fix them
  7. If any errors are reported that SFC was unable to fix, there are steps in this knowledge base article and this how-to guide that explain how to locate and attempt to fix the errors

Repairing .NET Framework 2.0/3.0 registry entries on Windows Vista

Unfortunately, there is not an easy way of repairing the registry keys/values that are installed by Windows Vista like there is for files.  If you want to try to repair the registry keys/values that are a part of the .NET Framework 2.0 and 3.0, you will need to run Windows Vista OS setup again and repair the OS.

<update date="9/8/2008"> Added a link to a knowledge base article with instructions that can be used to fix errors reported by sfc.exe on Windows Vista and Windows Server 2008. </update>

<update date="10/7/2008"> Clarified what SFC does behind the scenes in more detail. </update>

<update date="8/9/2009"> Fixed broken link to knowledge base article in step 7. </update>

<update date="3/10/2010"> Added a note about Windows 7. </update>


  • Hi Aaron,

    I made "ngen uninstall mscorlib.dll" recently and than after trying to install it again I am getting such a notice from ngen:

    c:\Windows\assembly\NativeImages_v2.0.50727_32>ngen install c:\Windows\Microsoft


    Microsoft (R) CLR Native Image Generator - Version 2.0.50727.312

    Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

    Installing assembly c:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll

    Failed to get dependencies for assembly. (Exception from HRESULT: 0x80131F00)

    And it seems that after recent vista updates there is some problem with dependencies but I have no idea what is the problem, because it seems that some libs that mscorlib.dll used is no longer present in the original version.

    The "reinstall" feature would be very useful in this case. This ngen uninstall/install mscorlib.dll problem reprod on other machine. Is it a .net 2.0 bug on vista?

    Are there any workaround for this problem without having to reinstall the vista itself?

  • Hi Mzygmunt - First of all, why would you want to uninstall the native image for Mscorlib?  This will cause all .NET Framework native images to be invalidated, and there's no reason you should ever need to do that.

    If you have gotten into this state, you should be able to run the following command to re-generate native images for all assemblies on your system:

    %windir%\Microsoft.NET\Framework\v2.0.50727\ngen.exe update

    Hopefully this helps.

  • A few days ago I was trying to play with Safari 3 beta for Windows without success. When I finally uninstalled it, Vista was so broken that it could not start anything that had to do with .NET 2.0 o 3.0. For instance, PowerShell failed to run, Visual Studio 2005 failed, NAnt failed to run, etc. I did not find your post but figured out myself that since now .NET is part of the OS "sfc /scannow" should fix it and it did. I post this comment here just in case someone runs into the same problem through the same path. I also installed Microsoft Visual C++ 2005 SP1 Redistributable, but I don't think it played a role.

  • Hi,

    I installed VB Express Orcas on Vista x64 and after the uninstall I could not run my old Apps. It says in the VStudio Error List that System, System.Data and all the other "basic" classes are missing from the system. It is really weird. I checked the REFERENCES LIST and I saw that it tries to load them from ...Framework/v2.0.50727/ folder which does not exist!

    I even found the Dlls and manually copied them there and still no cure.

  • I opened the command prompt as Administrator and attempted to follow your instructions and got the following:

    C:\Windows\system32>sfc /scannow

    Beginning system scan.  This process will take some time.

    Windows Resource Protection could not perform the requested operation.

    Any ideas as to what is wrong or what I'm doing wrong? Any help would be greatly appreciated. Thank you.

  • Hi Everydaypanos - I don't know of any cases where installing or uninstalling Orcas would remove the .NET Framework 2.0 files from %windir%\Microsoft.NET\Framework\v2.0.50727 - and those files are protected by Windows Resource Protection so it wouldn't be possible to delete them unless the process is running with special "Trusted Installer" privileges that are generally only granted to OS hotfixes and service packs.

    Did it help to run sfc /scannow to restore these files as described in this blog post?

    Also, I have heard of a bug in the .NET Framework 3.5 beta 1 that may be related to your scenario.  It is described at https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=285305&wa=wsignin1.0 and has been fixed in the .NET Framework 3.5 beta 2.

  • Hi Ogunther - I haven't heard of an error like that from the SFC tool until now.  It appears that you're running it correctly.  You might see some error messages in %windir%\logs\cbs\cbs.log that could help narrow down the root cause.  I'm not sure what to suggest for you other than to try to repair/re-install Windows Vista to get around this.  I'm sorry I'm not able to be more helpful in this scenario.

  • I'm having a similar problem with .NET 2.0 and sfc /scannow. Figured I'd post it here. In case anyone else ever runs into this.

    My .Net 2.0 is toast (suspect is a failed sleep or system crash that caused hard drive erorrs), and thanks to .Net being "integrated" I'm now going to have to re-install vista :(

    Here's the output in the debugger when I try to start a .Net application. I get the lovely "mscorwks.dll could not be loaded" dialog.

    ModLoad: 79e70000 7a3d6000   C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll

    LDR: LdrpWalkImportDescriptor() failed to probe C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll for its manifest, ntstatus 0xc0150002

    >sfc /scannow

    Beginning system scan.  This process will take some time.

    Beginning verification phase of system scan.

    Verification 85% complete.

    Windows Resource Protection could not perform the requested operation.

    from cbs.log:

    POQ 51 starts:

    POQ 51 ends.

    2007-08-23 23:27:27, Info                  CSI    00000122 [SR] Verify complete

    2007-08-23 23:27:27, Error                 CSI    00000123@2007/8/24:06:27:27.262 (F) d:\vistartm\base\wcp\componentstore\csd_locking.cpp(304): Error c015000c [Error,Facility=FACILITY_SXS_ERROR_CODE,Code=12 (0x000c)] originated in function CCSDirectTransaction::LockComponent expression: (null)


    2007-08-23 23:27:33, Error                 CSI    00000124 (F) c015000c [Error,Facility=FACILITY_SXS_ERROR_CODE,Code=12 (0x000c)] #1958342# from CCSDirectTransaction::OperateEnding at index 0 of 1 operations, disposition 2



  • Details about the .NET Framework 2.0 setup packaging Available command line switches for .NET Framework

  • I have previously posted some instructions ( here and here ) that can be used to verify and attempt to

  • I have previously posted some instructions ( here and here ) that can be used to verify and attempt to

  • Six weeks after installing Norton Ghost 12, it stopped working, failing to start with a .NET exception on System.Windows.Forms.ButtonRenderer. After uninstalling and reinstalling Ghost, it now fails to start with an exception on System.OutOfMemoryException.

    Norton support claims it is a problem with the .NET 2.0 framework. The "sfc /scannow" run reports:

      Verification 99% complete.Windows Resource Protection found corrupt files but was unable to fix some of them.

    CBS.log reports:

      Verify and Repair Transaction completed. All files and registry keys listed in this transaction  have been successfully repaired

    Ghost still fails. Is the .NET 2.0 framework bad? When you say "you will need to run Windows Vista OS setup again and repair the OS.", does this mean install the OS again? My system is an OEM purchase of Vista Business.


  • Hi Eddiee - This error could be caused by a bug in the application itself, or a problem in the .NET Framework.  It is difficult to say for sure without some further debugging though.  Do you see similar errors in other programs on this system that use the .NET Framework, or is it only in Ghost?  You may want to check on the Norton site to see if they have any FAQs that mention these errors that you're seeing to see if they have any suggested workarounds you could try.

    Yes, the steps I listed do mean that you would try to install the OS again.  Usually, an OEM system comes with some sort of recovery disc that can be used to do this as a last resort if you need to.

  • My boss had some problems on his PC after installing some tools onto it and upon further diagnosis it

  • OK-I tried the .NET cleanup tool and using SFC. SFC didn't find anything wrong and removing and reinstalling all of the versions of .NET FW didn't help. Any .NET application I run fails in one way or another.

    Is there any other technique out there or am I just stuck formatting my drive and starting over? (The tried and true fix for any version of Windows!)

Page 1 of 15 (223 items) 12345»
Leave a Comment
  • Please add 7 and 5 and type the answer here:
  • Post