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
  • how to remove this crap...with shitty .net created folders on other partitions... with permissions, so as to prevent users from easily removing the folders!

    0ddd98559605c791c6fa0f28db52

    a74c4326ab6f25571585cf21d2176d87

    ---------------------------

    Error Deleting File or Folder

    ---------------------------

    Cannot remove folder update: Access is denied.

    Make sure the disk is not full or write-protected

    and that the file is not currently in use.

    ---------------------------

    OK  

    ---------------------------

    ---------------------------

    0ddd98559605c791c6fa0f28db52

    ---------------------------

    M:\0ddd98559605c791c6fa0f28db52\update is not accessible.

    Access is denied.

    ---------------------------

    OK  

    ---------------------------

    please explain why MS create such a crap .Net installations and install extra bloat I didn't want? too hard to make a proper customized setup?

  • Hi Xeonz - I'm sorry for the hassles that this issue is causing for you.  You can right-click on the folder you are getting access denied for, choose the Security tab, and grant your user account full control so that you can delete this folder.  This issue will be corrected in a future release of the .NET Framework.

  • Hi astebner,

    I am also getting "Access is Denied" errors when running the cleanup tool under Vista Enterprise x64.  I somehow got into a state where the .NET framework is not in the "programs and features" uninstall panel, however neither installing .NET framework through Windows Update nor through microsoft's executable works.

    Its very frustrating to be getting these "access is denied" errors when running the cleanup tool as an administrator.  I even booted into safe mode, but still get "access is denied."

    I see you suggest changing permissions on folders, but one of the folders that I am getting an error on is C:\Windows\System32, and though I am no windows expert, I think its a bad idea to change permissions on that folder.

    It would be nice to see a version of the cleanup tool that fixes the "access is denied" errors sooner rather than later.  Thanks for all your work on this tool.

  • how impressive it is!

    I just spend all the morning trying to fix a "setup cannot conitue because this version of the .net framework is incompatible with a previously installed one" for .net framework 2.0 on a windows xp pro tablet Pc edidtion

    and nothing works until I found you're tool, I've was about to re image the laptop, so thanks a lot!

  • Hi Dogshu - The cleanup tool does not attempt to make any changes to file system or registry permissions.  It works correctly on all versions of Windows (including Vista) that have the default permissions for the system32 directory that are set during Windows setup.  I'm not sure how the permissions got changed on your system, but they sound like they are too restrictive to allow your user account to make any changes to system32 even if you're running elevated.  I'd normally suggest manually updating the permissions to make sure that the Administrators group and the local system account have full control over that directory, but if you don't feel comfortable doing that, you may want to repair/re-install Windows in order to restore the default permissions.

  • This is a superb tool! Thanks for the great work: after slogging over it for hours we were up and away in minutes ;-)

  • YEESSS! Aaron... You da man!!! I've been trying to either update or remove my .NET Framework installation (without success) for a couple of months now (inadvertently did a system restore on the wrong computer). Was getting ready to reformat then re-install XP when I found your Cleanup Tool! It rocks...

  • Thanks for Tool.

    Its removed .Net framework 2.0a and saved lot of time

    Thanks and All the best for future development

    Elumalai

  • yes a very nice tool indeed

  • I have trouble to Install FW 3.5SP1 "because of missing FW 2.0SP2 files, but Cleanup resolve it. Thans a lot.

  • Many thanks this bug was driving me crazy, I was seriously thinking about a system reload.

  • Hi,

    I have a problem with my .net framework.I have a share point server which has direct internet access.ON dec 7th '09 it was updated with several hotfixes related to .net framework 2.0 and 3.5.Now i cannot access the central administration tool of the server.I know this is because of the recently patched versions.How to uninstall only those updates which are patched.Please help me on this

    Regards,

    Mellvin.

  • Hi Mellvin - Any updates that you have installed that allow you to uninstall them should appear in the Add/Remove Programs or Programs and Features control panels.  If you don't see the update listed there, it doesn't support uninstall, and if you need to remove it you would need to do one of the following instead:

    1.  Uninstall and re-install the entire .NET Framework.

    2.  Restore to an earlier system restore checkpoint from before the update was installed if you have one.

  • Hi astebner,

    Yeah i didn't get that updates uninstall option in my control panel and my server is win2k3 which doesn't have system restore.

    So the only option is to reinstall the .net framework right?can't i manually uninstall the updates alone?

    Thanks in advance,

    Mellvin.

  • Hi Mellvin - Some updates allow you to uninstall them individually, but some do not.  If the update you want to remove doesn't have an uninstall option listed for it in Add/Remove Programs, then the only options I know of to remove that update are to uninstall and re-install the .NET Framewor itself or to use a system restore checkpoint (which you already said you didn't have on your system).  Sorry for the hassles.  :-(

Page 3 of 35 (517 items) 12345»
Leave a Comment
  • Please add 4 and 4 and type the answer here:
  • Post