How to manually cleanup a failed .NET Framework 2.0 install
In response to the blog article I posted last week where I provided a link to a .NET Framework manual cleanup tool, I got some questions about whether or not a comparable version is available for cleaning up the .NET Framework 2.0. I am currently working on a couple of small work items in the code for the tool to enable it to work with 2.0, but in the meantime I wanted to post some manual steps. I know there have been a lot of uninstall/reinstall issues because we have released an alpha, a beta and numerous Community Tech Preview (CTP) versions and not all of them will uninstall completely cleanly in order to allow a future beta version of 2.0 to install correctly.
The following steps will help resolve .NET Framework 2.0 installation failures/hangs in most cases. Before proceeding please note these important caveats:
- These steps will only work for the .NET Framework 2.0 installed by dotnetfx.exe (the MSI-based setup). There is a version of .NET Framework 2.0 that is installed as part of the OS if you are running any pre-release builds of Windows codename Longhorn. You should not use these steps on Longhorn.
- These steps will damage the .NET Framework 1.0 or 1.1 if you have either of these versions installed on your computer. This is because you are instructed to rename the file mscoree.dll that is shared by all versions of the .NET Framework. If you have 1.0 or 1.1 installed, you will need to immediately install a later build of .NET Framework 2.0 to update mscoree.dll or perform a repair of the .NET Framework 1.0 or 1.1. To repair .NET Framework 1.0 or 1.1, go to the Add or Remove Programs control panel, click on the link for support information, and then click on the Readme link.
- If you are running Windows Server 2003, Windows XP Media Center Edition or Windows XP Tablet PC Edition, there is a version of the .NET Framework that ships as part of the OS. In those situations, you cannot repair by using the instructions in Add or Remove Programs under the readme link. In those scenarios it is strongly recommended that you immediately install .NET Framework 2.0 to provide an updated version of mscoree.dll. If that is not an option, you must repair your OS to fix the issue.
Steps to clean up a machine to fix a failed .NET Framework 2.0 installation:
Using Add or Remove Programs, locate any versions of the .NET Framework 1.2 or 2.0 and choose Remove to uninstall them
Using regedit, navigate to HKLM\Software\Microsoft\.NETFramework and delete any keys and values that have 1.2 or 2.0 in it, including keys/values that are in subkeys underneath .NETFramework.
Using regedit, navigate to the sub-hive HKLM\Software\Microsoft\.NETFramework\Policy and delete any key or value that has 1.2 or 2.0 in it.
Using regedit, navigate to HKLM\Software\Microsoft\ASP.NET and delete any key or value that has 1.2 or 2.0 in it, including keys/values that are in subkeys underneath ASP.NET.
Right-click on My Computer and choose Manage. Expand Computer Management (Local), then Local Users and Groups, then click on the Users folder. In the right-hand pane, right-click on the ASPNET user account and choose Delete to remove it.
Go to %windir%\assembly and delete anything with *1.2* or *2.0* in the folder name. Delete the GAC_32 and GAC_MSIL folders as well.
You can not view the contents of %windir%\assembly in Windows Explorer when the .NET Framework is installed. In order to view the contents, you will need to set the following registry value and reopen Windows Explorer
Key name: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion
Value name: DisableCacheViewer
Data type: REG_DWORD
Value data: 1
Note: You should remove the DisableCacheViewer value after you complete this step because this is only used for debugging purposes.
Go to %windir%\Microsoft.NET\Framework and delete any folders named v1.2.* or v2.0.* along with all of the files and subfolders they contain. You may get errors when trying to delete some of the files because they are in use. In most cases, rebooting the machine and trying again will work. If not, you can rename the files to be <filename>.old and then delete them after a future reboot.
Rename %windir%\system32\mscoree.dll to mscoree.dll.old.
After doing all of this, try to install the previously failing version of the .NET Framework 2.0.
If you have any trouble getting these steps to work correctly please let me know. Also stay tuned for a future post once I get the cleanup tool updated to work with .NET Framework 2.0 and post it for download.