Aaron Stebner's WebLog

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

.NET Framework Cleanup Tool User's Guide

.NET Framework Cleanup Tool User's Guide

Rate This

.NET Framework Cleanup Tool User's Guide

Introduction

This .NET Framework cleanup tool is designed to automatically perform a set of steps to remove selected versions of the .NET Framework from a computer.  It will remove files, directories, registry keys and values and Windows Installer product registration information for the .NET Framework.  The tool is intended primarily to return your system to a known (relatively clean) state in case you are encountering .NET Framework installation, uninstallation, repair or patching errors so that you can try to install again.

There are a couple of very important caveats that you should review before using this tool to remove any version of the .NET Framework from your system:

  • This tool is designed as a last resort for cases where install, uninstall, repair or patch installation did not succeed for unusual reasons.  It is not a substitute for the standard uninstall procedure.  You should try the .NET Framework Repair Tool and then try the steps listed in this blog post before using this cleanup tool.
  • This cleanup tool will delete shared files and registry keys used by other versions of the .NET Framework.  If you run the cleanup tool, you will need to perform a repair/re-install for all other versions of the .NET Framework that are on your computer or they will not work correctly afterwards.
  • Additional support can be obtained by visiting the .NET Framework setup forum at http://social.msdn.microsoft.com/Forums/en-US/netfxsetup/threads.

Download location

The .NET Framework cleanup tool is available for download at the following locations:

The .zip file that contains the tool also contains a file named history.txt that lists when the most recent version of the tool was published and what changes have been made to the tool over time.

Supported products

The .NET Framework cleanup tool supports removing the following products:

  • .NET Framework - All Versions
  • .NET Framework - All Versions (Tablet PC and Media Center)
  • .NET Framework - All Versions (Windows Server 2003)
  • .NET Framework - All Versions (Windows Vista and Windows Server 2008)
  • .NET Framework - All Versions (Windows 7)
  • .NET Framework 1.0
  • .NET Framework 1.1
  • .NET Framework 2.0
  • .NET Framework 3.0
  • .NET Framework 3.5
  • .NET Framework 4
  • .NET Framework 4.5
  • .NET Framework 4.5.1
  • .NET Framework 4.5.2

Not all of the above products will appear in the UI for the .NET Framework cleanup tool on every operating system.  The cleanup tool contains logic so that if it is run on an OS version that includes the .NET Framework as an OS component, it will not offer the option to clean it up.  This means that running the cleanup tool on Windows XP Media Center Edition or Tablet PC Edition will not offer the option to clean up the .NET Framework 1.0, running it on Windows Server 2003 will not offer the option to clean up the .NET Framework 1.1 and running it on Windows Vista or Windows Server 2008 will not offer the option to clean up the .NET Framework 2.0 or the .NET Framework 3.0.

When choosing to remove any of the above versions of the .NET Framework, the cleanup tool will also remove any associated hotfixes and service packs.  You do not need to run any separate steps to remove the service pack(s) for a version of the .NET Framework.

Silent installation mode

The .NET Framework cleanup tool supports running in silent mode.  In this mode, the tool will run without showing any UI, and the user must pass in a version of the .NET Framework to remove as a command line parameter.  To run the cleanup tool in silent mode, you need to download the cleanup tool, extract the file cleanup_tool.exe from the zip file, and then run it using syntax like the following:

cleanup_tool.exe /q:a /c:"cleanup.exe /p <name of product to remove>"

The value that you pass with the /p switch to replace <name of product to remove> in this example must exactly match one of the products listed in the Supported products section above.  For example, if you would like to run the cleanup tool in silent mode and remove the .NET Framework 1.1, you would use a command line like the following:

cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 1.1"

One important note – as indicated above, the cleanup tool will not allow you to remove a version of the .NET Framework that is installed as part of the OS it is running on.  That means that even if you try this example command line on Windows Server 2003, the tool will exit with a failure return code and not allow you to remove the .NET Framework 1.1 because it is a part of that OS.

Similarly, you cannot use the cleanup tool to remove the .NET Framework 1.0 from Windows XP Media Center Edition or Windows XP Tablet PC Edition or remove the .NET Framework 2.0 or 3.0 from Windows Vista or Windows Server 2008.  In addition, if you run the cleanup tool on an OS that has any edition of the .NET Framework installed as a part of the OS, it will prevent you from using the .NET Framework - All Versions option because there is at least one version that it cannot remove.

If you are planning to run the cleanup tool in silent mode, you need to make sure to detect what OS it is running on and not pass in a version of the .NET Framework with the /p switch that is a part of the OS or make sure that you know how to handle the failure exit code that you will get back from the cleanup tool in that type of scenario.

Unattended installation mode

The .NET Framework cleanup tool supports running in silent mode.  In this mode, the tool will run and only show a progress dialog during removal, but will require no user interaction.  Unattended mode requires the user to pass in a version of the .NET Framework to remove as a command line parameter.  To run the cleanup tool in unattended mode, you need to download the cleanup tool, extract the file cleanup_tool.exe from the zip file, and then run it using syntax like the following:

cleanup_tool.exe /q:a /c:"cleanup.exe /p <name of product to remove> /u"

For example, if you would like to run the cleanup tool in unattended mode and remove the .NET Framework 1.1, you would use a command line like the following:

cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 1.1 /u" 

Exit codes

The cleanup tool can returns the following exit codes:

  • 0 - cleanup completed successfully for the specified product
  • 3010 - cleanup completed successfully for the specified product and a reboot is required to complete the cleanup process
  • 1 - cleanup tool requires administrative privileges on the machine
  • 2 - the required file cleanup.ini was not found in the same path as cleanup.exe
  • 3 - a product name was passed in that cannot be removed because it is a part of the OS on the system that the cleanup tool is running on
  • 4 - a product name was passed in that does not exist in cleanup.ini
  • 100 - cleanup was able to start but failed during the cleanup process
  • 1602 - cleanup was cancelled

Log files

The cleanup tool creates the following log files:

  • %temp%\cleanup_main.log - a log of all activity during each run of the cleanup tool; this is a superset of the logs listed below as well as some additional information
  • %temp%\cleanup_actions.log - a log of actions taken during removal of each product; it will list files that it finds and removes, product codes it tries to remove, registry entries it tries to remove, etc.
  • %temp%\cleanup_errors.log - a log of errors and warnings encountered during each run of the cleanup tool

 

Attachment: dotnetfx_cleanup_tool.zip
  • Good morning. I wonder if when you have a few moments, you might help me out with .NET Framework. I used the cleanup tool because windows update could not install .NET update. I did not save the original error message, sorry. I ran the cleanup tool and it came back with a successful message. I then downloaded dotnetfx35.exe and NDP35SP1-KB958484-x86.exe. I ran dotnetfx356.exe and got the error message:

    [02/06/10,20:58:55] Microsoft .NET Framework 2.0a: [2] Error: Installation failed for component Microsoft .NET Framework 2.0a. MSI returned error code 1603

    [02/07/10,08:21:03] Microsoft .NET Framework 2.0a: [2] Error: Installation failed for component Microsoft .NET Framework 2.0a. MSI returned error code 1603

    [02/07/10,08:21:30] WapUI: [2] DepCheck indicates Microsoft .NET Framework 2.0a is not installed.

    [02/07/10,08:54:29] Microsoft .NET Framework 2.0a: [2] Error: Installation failed for component Microsoft .NET Framework 2.0a. MSI returned error code 1603

    [02/07/10,08:54:56] WapUI: [2] DepCheck indicates Microsoft .NET Framework 2.0a is not installed.

    What do I do next?

  • UPDATE: I tried re-installing .NET 2.0 by this method: http://support.microsoft.com/kb/908077/

    I also re-installed Windows Installer. I get the following error message when I then try to install .Net 2.0:

    Error 1406. Could not write value C:\WINDOWS\Microsoft.net\Framework\v1.0.3705\System.Windows.Forms.tlb to key \Software\Microsoft\Windows\CurrentVersion\SharedDlls. Verify that you have sufficient access to that key, or contact your support personnel.

    I am really stumped now.

  • Hi Perzaklie - If you're getting a 1406 error, that means you are missing some permissions that are needed to install the .NET Framework.  You can fix the permissions on your system by using a tool like the one described at http://blogs.msdn.com/astebner/archive/2006/09/04/solving-setup-errors-by-using-the-subinacl-tool-to-repair-file-and-registry-permissions.aspx.

    If you still cannot install the .NET Framework after updating your permissions, please use the tool described at http://blogs.msdn.com/astebner/archive/2007/11/21/6458047.aspx to gather your .NET Framework setup log files, upload them to a file server such as http://skydrive.live.com, and then reply back here with a link that I can use to download the log files and take a further look.

  • Hi Idontknow - I wanted to make a couple of comments about your scenario.  The cleanup tool is not a full replacement for the normal uninstall process for the .NET Framework, and there are some cases where information is left behind.  The tool is only intended to remove enough of the .NET Framework to allow a future re-install to succeed.

    If an item is listed in Add/Remove Programs, that doesn't necessarily mean that the program is actually installed.  Add/Remove Programs looks at information listed in the registry under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall and displays whatever is listed there.  In the case of those .NET Framework hotfixes, the cleanup tool doesn't remove the Add/Remove Programs registry keys for every one of them, so they end up still appearing in that list even if the files that are a part of the hotfixes get removed.

    I definitely suggest trying to re-install the .NET Framework 3.5 SP1 instead of re-installing 2.0, then 3.0 then 3.5.  The 3.5 SP1 will install 2.0 SP2 and 3.0 SP2 behind the scenes, so that can save you needing to download and install those versions separately.

    I suggest downloading and installing the .NET Framework 3.5 SP1 directly instead of using Windows Update though.  Windows Update will run the installer in silent mode, which will hide any error messages.  Running the installer directly will provide more useful troubleshooting information in case of a failure.

  • Running XP SP3 and every important update needed, I had problems with installation of version 3.5, I already had version 1, 1.1 & 2. I was trying to reset permissions in the registry and accidentally hit the delete key and screwed up the registry. Best move was to format and start all over from scratch, so I did the format and fresh OS install, SP3, all the important updates except now not one version of .NET framework will install, every time an install starts it will get to the point of registering system.enterpriseservices.dll and the PC reboots itself. After restart event viewer shows windows installer reports that the .net framework installation was a success. I have tried your cleanup tool, permissions tool, msconfig services etc and still have no luck installing. I am starting off by installing version 3.5. Any tips or suggestions to help keep my sanity and get some sleep would be greatly appreciated.

  • Hi Ajc1958 - I've heard of different types of issues related to registering System.EnterpriseServices.dll, but this is the first time I've heard of the system rebooting on its own during .NET Framework setup.  I'd first suggest trying to install the .NET Framework 3.5 SP1 since that is the latest version, and it contains some fixes that might help in this type of scenario.

    If that doesn't help, then I'd suggest trying to use the steps listed at http://blogs.msdn.com/astebner/archive/2006/11/25/disabling-services-with-msconfig-to-work-around-setup-failures.aspx in case there is some other process running on your system that is interfering with .NET Framework setup.

  • I have used this file several times and absolutely love it, I have founf however that once it is done running, the C:\WINDOWS\Microsoft.NET\Framework has not been cleared. In serveral instances after running this app, I have discovered that clearing the contents of this folder but not removing the folder its self resolves quite a few more errors that were not resolved simply by just running this tool.

    If this is a repost of data listed somewhere else, I appologise.

  • Hi Aero98 - Thanks for the feedback on the cleanup tool.  The tool is not designed as a replacement for the standard product uninstall process (it is intended to remove enough of the .NET Framework to allow a future installation to succeed).  As a result, it is expected that it will not fully remove the c:\Windows\Microsoft.NET\Framework directory.

    If you're seeing problems installing the .NET Framework after running the tool because of some of the files that are left behind, then please let me know more details about your scenario (what files are causing problems, what exact error messages you are seeing, etc) so I can look into improving the tool in the future.

  • Thanks - excellent tool, had to run it twice but it worked like a charm....saved my butt!

  • I downloaded the cleanup tool successfully, but when I tried to open the zip file, I got a message "The compressed (zipped) file is invalid or corrupt."  I tried both versions (the two links) and both gave the same result.

  • Hi Terry K - I'm not sure why you would be getting that error.  Both of the zip files work fine for me on multiple computers that I've tried them on.  Do you have problems opening other zip files on your computer as well?

  • Will this tool work with Windows 7 64 bit? I especially want to remove the 3.5 that is installed with it.

  • We resolved your issue by Install the .NET Framework Cleanup Tool by going to blogs.msdn.com/.../8904493.aspx.

    Upon execution, select .Net - All Versions as the product to clean up.

    Select Cleanup Now.

    When finished, reboot your computer.

    They don't make it easy!!!!!!!

  • Hi Ben Gasser - The cleanup tool will run correctly on Windows 7.  However, it will not allow you to remove the .NET Framework 3.5 on Windows 7 because that version of the .NET Framework is an OS component, and the cleanup tool does not allow you to remove versions of the .NET Framework that are installed as OS components.

    If you want to remove the .NET Framework 3.5 on Windows 7, then you can go to the Programs and Features control panel, click on the link on the left side that is labeled Turn Windows features on or off, then uncheck the item named Microsoft .NET Framework 3.5.1 and click OK.

  • jammer, bij mij lukt het helaas niet. O zo vaak geprobeerd.

    Ik heb Windows XP Versie 2002 Service Pack 3.

    Gekocht in 2008 en altijd problemen. Ook na opnieuw installeren en zo.

Page 5 of 35 (517 items) «34567»
Leave a Comment
  • Please add 7 and 8 and type the answer here:
  • Post