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:
- Click on the Start menu, choose All Programs, then Accessories, then right-click on the Command Prompt item and select Run as administrator
- Click Continue to authorize opening a command prompt with administrative privileges
- Run this command in the cmd prompt: sfc /scannow
- The cmd prompt should list text stating "Beginning system scan. This process will take some time."
- 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
- 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
- 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>