Welcome to MSDN Blogs Sign in | Join | Help

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

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 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>

 

Published Monday, March 26, 2007 5:09 PM by astebner

Comments

Wednesday, April 11, 2007 2:40 PM by mzygmunt

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

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

.NET\Framework\v2.0.50727\mscorlib.dll

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?

Thursday, April 12, 2007 12:14 PM by astebner

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

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.

Monday, June 18, 2007 1:32 PM by diegov

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

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.

Wednesday, July 18, 2007 5:28 AM by everydaypanos

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

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.

Wednesday, July 18, 2007 5:46 PM by ogunther

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

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.

Thursday, July 19, 2007 10:54 PM by astebner

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

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.

Thursday, July 19, 2007 11:03 PM by astebner

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

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.

Friday, August 24, 2007 2:38 AM by Jslone

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

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)

[gle=0x80004005]

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

:(

-Justin

Thursday, September 13, 2007 4:59 PM by Aaron Stebner's WebLog

# Unified .NET Framework Troubleshooting Guide

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

Friday, December 21, 2007 6:57 PM by Aaron Stebner's WebLog

# Link to knowledge base article describing how to repair Windows Vista OS files

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

Friday, December 21, 2007 7:33 PM by Noticias externas

# Link to knowledge base article describing how to repair Windows Vista OS files

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

Thursday, December 27, 2007 7:19 AM by eddiee

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

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.

Eddie

Monday, December 31, 2007 1:10 PM by astebner

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

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.

Friday, February 01, 2008 2:32 AM by David Overton's Blog

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

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

Saturday, March 15, 2008 8:45 PM by pvandegriff

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

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!)

Monday, March 17, 2008 12:23 AM by astebner

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

Hi Pvandegriff - The .NET Framework cleanup tool does not allow you to remove the .NET Framework 2.0 or 3.0 on Windows Vista because those versions are a part of the OS.  It might help to install Vista SP1 because Vista SP1 includes the .NET Framework 2.0 SP1 and 3.0 SP1.  It might also help to try running the .NET Framework verification tool described at http://blogs.msdn.com/astebner/archive/2008/03/03/8015158.aspx to see if it reports any errors.  You can send me the log file from that tool if it does report errors and I can take a look to see if I can suggest anything.  If you do that, you can send the log to Aaron.Stebner (at) microsoft (dot) com.

If all else fails, you will likely need to repair/re-install Windows Vista to try to fix any issues you have with the .NET Framework 2.0 or 3.0 on this OS.

Monday, March 17, 2008 9:30 AM by Micato

# Going off a tangent ... ;-)

Hi Aaron - due to my installation errors from Visual Studio 2008 pro, I ended temporarily in checking my .NET Environment.

The sfc reports: 100% complete -> the WRP found errors -> could not repair some of them (a German Vista is installed here).

The log is 15MB big(!). Perhaps a summary from an "error" search is helpful:

**** cbs.log ****

Line 51161: 2008-03-14 16:08:03, Error              Failed to find the CixTarget for Container package_1_for_kb110806~31bf3856ad364e35~x86~~6.0.6000.1318.cat

Line 51162: 2008-03-14 16:08:03, Error                        DpxException hr=0x80070002 code=0x020109

Line 61352: 2008-03-14 16:13:24, Error                        Failed to find the CixTarget for Container package_2_for_kb929300~31bf3856ad364e35~x86~~6.0.6000.525.cat

Line 61353: 2008-03-14 16:13:24, Error                        DpxException hr=0x80070002 code=0x020109

Line 61354: 2008-03-14 16:13:24, Error                        Failed to find the CixTarget for Container package_1_for_kb929300~31bf3856ad364e35~x86~~6.0.6000.525.cat

Line 61355: 2008-03-14 16:13:24, Error                        DpxException hr=0x80070002 code=0x020109

**** cbs.log (end) ****

Thanks in advance for any hints,

regards Matthias.

Monday, March 17, 2008 11:35 AM by astebner

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

Hi Micato - The errors you listed do not appear to be related to Visual Studio 2008 setup.  Can you please zip and send me the log files from VS 2008 setup on your system so I can take a look and see if I can figure out anything about the cause of the error?  You can find a list of possible log files at http://blogs.msdn.com/astebner/archive/2007/07/31/4156781.aspx.  You can send the zip file with the logs to Aaron.Stebner (at) microsoft (dot) com.

Monday, July 28, 2008 8:56 PM by Aaron Stebner's WebLog

# Link to System Update Readiness Tool for Windows Vista that can help fix Vista OS update install errors

I have heard from several customers in the past who have had issues installing hotfixes or updates for

Friday, December 26, 2008 8:20 AM by Tacos

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

Hello Aaron. I'm having trouble with getting .NET Framework 2.0 and 3.0 installed/fixed. When I try to run the files for 2.0 and 3.0, it says 2.0 is installed and 3.0 needs me to go into "Turn windows functions on or off" in the control panel. The problem there is that when I go to that function in the control panel, the window for options is completely blank.

I also tried using the sfc /scannow command, but it gave me the message "There is a system repair pending which requires reboot to complete. Restart Windows and run sfc again." The problem is that this message comes up even if I try running it immediately after a reboot.

Any help would be greatly appreciated. I can't even install some programs until I get this whole thing sorted out.

Monday, January 05, 2009 11:23 AM by astebner

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

Hi Tacos - It sounds like there is something stuck on your system that makes Windows think that there is an OS update in progress.  In the past, I've seen this caused by the following registry value:

[HKEY_LOCAL_MACHINE\Components]

StoreDirty

Can you check and see if you have this value at this location, and if so, delete it, reboot and see if that will allow the Windows Features dialog to correctly display the list of Windows components so you can enable the .NET Framework 3.0?

Wednesday, February 11, 2009 9:01 PM by Aaron Stebner's WebLog

# How to perform a silent repair and uninstall of the .NET Framework 2.0 SP2 and 3.0 SP2

A while back, I wrote a blog post about how to perform silent repairs and uninstalls for the .NET Framework

Anonymous comments are disabled
 
Page view tracker