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
  • If I am running Windows XP home edition and do not development software applications, do I need to install .NET Framework component that supports building and running the next generation of applications and XML Web services.

    Trying to determine if.NET Framework component is really needed to run Windows XP home edition when I am not developing software applications.  

    Thanks

  • Hi Gbowers - The .NET Framework is a runtime component.  Even if you are not a software developer, you would need it on your system in order to be able to run any applications you have installed that are created by other people/companies if those applications were built with the .NET Framework.  Most of those applications will install the .NET Framework as a part of their setup if it is not yet on the system though, so most of the time it is not necessary to install the .NET Framework by itself.

    If you decide to not install the .NET Framework but have an application that needs it, you will end up seeing an error message like the one described at http://blogs.msdn.com/astebner/archive/2009/04/20/9557946.aspx.

  • Hello,

    I've been having problems with Windows Updates. One of the solutions I found was to remove and reinstall the .Net Framework, which led me to this tool. However, when I run it the "Removing registry information" process hangs. The last few lines of the main.log read:

    [01/07/10,13:24:41] Found entry HKLM,Software\Microsoft\.NETFramework\v1.2.*, performing action now

    [01/07/10,13:24:41] Found entry HKLM,Software\Microsoft\.NETFramework\v2.0.4*, performing action now

    [01/07/10,13:24:41] Found entry HKLM,Software\Microsoft\.NETFramework\v2.0.5*, performing action now

    [01/07/10,13:24:41] Deleting registry key 'Software\Microsoft\.NETFramework\v2.0.50727'

    I've tried running the utility a couple times (after leaving on over night the first time, just to make sure) and it always hangs at this point in the log.

    errors.log:

    [01/07/10,13:23:54] Beginning of new cleanup utility session

    [01/07/10,13:24:04] Failed to open the service 'msftpsvc'

    [01/07/10,13:24:04] Failed to open the service 'nntpsvc'

    [01/07/10,13:24:04] Failed to open the service 'smtpsvc'

    [01/07/10,13:24:04] Failed to open the service 'w3svc'

    [01/07/10,13:24:04] Failed to open the service 'iisadmin'

    I'm really at a loss as to what I should do at this point short of attempting to uninstall and reinstall everything on my machine or just reformat altogether.

    I'm running WinXP, SP3, I've tried reinstalling SP3 as well as stopping all non Windows services through msconfig. Any suggestions would be greatly appreciated.

    Thanks,

    Jason

  • Hi Jaerdon - There is one case I know of where the cleanup tool will hang while trying to delete registry keys - it tries to recursively delete some keys and all of their values, and if one of those fails due to an access denied error or something like that, then it will get stuck trying to delete it over and over.  I need to make a fix to the cleanup tool for that scenario but haven't had time yet unfortunately.

    In the meantime, you should be able to try to manually delete the keys that it is getting stuck on and then re-run the tool to see if that will help get it running correctly.  Can you see if you can manually delete HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\v2.0.50727 and any other sub-keys you might have at that location that start with v2.0.* and then re-run the tool to see if that helps unblock things?

  • Thanks aaron, for the tool and support...

    when i ran the tool - for all versions - nothing happened for over an hour. all i could see was the info on UI that said something about removing registry.

    since i could not hold my patience, i stopped the proces (through task manager, as the 'exit' button was not highlighted.

    when i visited the log, the last entry was after 17 minutes of start - more than 50 minutes beofre i forced stopped it.

    i trid this second time - with the same result.

    i then looked into the error report, and i saw many services couldnot be stopped, and lot of entries came back with error code "1".

    what went wrong? what can i do? how do i get full admin rights to run this?

    i am not posting/pasting the log here as it is huge.

    i am the main user, and till today i thought i had ALL the administrator rights (as my user profile is with Admin rights).

    the system info is:

    OS:

    Windows XP Home Edition Service Pack 2 (build 2600)

    Processor:

    2.67 gigahertz Intel Pentium 4; 16 kilobyte primary memory cache; 1024 kilobyte secondary memory cache; 64-bit ready; Not hyper-threaded

    Card/Board:

    MICRO-STAR INTERNATIONAL CO., LTD MS-7131 REV:1.0; Bus Clock: 133 megahertz; BIOS: Phoenix Technologies, LTD 6.00 PG 02/18/2005

    RAM:

    512 MB

    80 GB NTFS HDD

    i hope this info will suffice. i can paste the log, if u need.

    warm regards

    biren shah

  • Hi Biren - There is one possible scenario where the cleanup tool can hang while attempting to remove registry keys.  In order to see if that is what is happening on your computer, can you please zip up all of the logs from the cleanup tool (there should be 3 of them, named %temp%\cleanup*.log), then upload the zip file to a file server of your choice (such as http://skydrive.live.com), then reply here with a link I can use to download the logs and take a look?

  • hi aaron,

    after posting my troubles here, i once again ran the tool... and left it all night running.

    the next day morning, when i came back to my comp., the process was still running - and using 100% CPU (in task manager).

    so, i ended the process through task manager.

    when i tried to restart the m/c., it crashed.

    on next try, it let me in till the log on. as i signed in with my PW, it returned an error about windows activation.

    i spent the whole day and the next, and have somehow got the system to start. but it is very unstable. and i am trying to find the causes and chinks in the armours.

    there seem to be so many that i am overwhelmed, right now.

    :)

    i have uploaded 2 sets of the (3) logs - as a zip, here:

    http://cid-efb4004e50005a8b.skydrive.live.com/self.aspx/.Public

    it would be a huge relief if you could reply 'yesterday'... but today will do.

    :)

    thank you aaron. i really appreciate your help, and a relief that you are there.

  • aaron,

    i am subscribed to this post... yet... why did i not get the email of your comment post?

    anything i didnot do, or did wrong?

    regards

    biren

  • Hi Biren - From your cleanup logs, it looks like the tool is having trouble deleting the following registry key:

    [HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\v2.0.50727]

    Can you please try to manually delete that key using regedit.exe and then re-run the cleanup tool and see if it will finish successfully after that?  If it still ends up hanging, can you please post an updated set of logs from the cleanup tool so I can take a further look?

    I'm sorry for the hassles with the subscription functionality.  I don't have any control over that behavior though - that is something that is happening in the blog hosting engine that blogs.msdn.com uses.  For now, I guess you'll have to manually monitor for updated comments.

  • under HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\v2.0.50727 ,there is another (sub)key NGenService, under that , two more - state and roots.

    the roots subkey has a huge list of subkeys...

    am i to select the key (folder) named v2.0.50727, and thru edit menu list, click delete? and when i am asked : "are you sure you want to delete this key and all of its subkeys?"

    i just click 'yes'?

    i accessed this thru running 'regedit' from "Run".

    i am sorry... i am very new to this.

    thanks

    biren

  • Hi Biren - You will need to open regedit.exe, go to the key named HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\v2.0.50727, click Delete, and then click Yes when it asks if you want to delete the key and all of its sub-keys.  After it finishes deleting the key and its sub-keys, hopefully you'll be able to run the cleanup tool and have it complete successfully, and then re-install the .NET Framework successfully.

  • thnks aaro.

    will do it and get back with feedback.

    rgds

    biren

  • dear aaron,

    couldn't do it.

    deletion was refused.

    i tried going down the levels under v2.0.50727... but even those were refused.

    under .NETFramework, apart from v2.0.50727, there is another key PendingUpdates, which has subkey for .NET1.1 - v1.1.4322.

    couldn't delete that too.

    i am trying to restore PC's health state thru fred langa's steps: XP's No-Reformat, Nondestructive Total-Rebuild Option (http://www.informationweek.com/news/windows/showArticle.jhtml?articleID=189400897)

    lets see what happens.

    will all the .NET traces go with that?

    rgds

    biren

  • Hi Biren - You can try to manually update the permissions on this registry key by right-clicking on the key in regedit.exe, choosing Properties, then going to the security tab and making sure that the SYSTEM account and the Administrators group have full control.  Or, you could try to use a tool like SubInAcl (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) to change the permissions for you.  Hopefully, after doing that you'll be able to delete that key and proceed with the cleanup process.

    If the above doesn't work either, then the information in that article you found looks like it could be useful here as well.

  • Some things to consider for the next cleanup tool version.  I look to see that the add/remove list is clean before attempting reinstall.

    I find the following local machine windows current version uninstall registry entries are not removed by the tool (and probably the associated uninstall backup folders):

    hotfix for 1.1 (Article ID: 889411, I neglected to document exact entry)

    Note, clicking remove cleared it.

    The following are not responsive to remove button.

    For 2.0, entries

    KB917283.T1_1ToU93_1

    KB922770.T1_1ToU168_1.

    For 3.5, entries

    {CE2CDD62-0124-36CA-84D3-9F4DCF5C5BD9}.KB953595

    i.e. Hotfix for Microsoft .NET Framework 3.5 SP1 (KB953595)

    {CE2CDD62-0124-36CA-84D3-9F4DCF5C5BD9}.KB958484

    i.e Hotfix for Microsoft .NET Framework 3.5 SP1 (KB958484)

    Reinstall idea for 2.0 thru 3.5:  rather that going through the pain of so many sequential installs as listed at the end of the guide, use the windows update under optional software listing of

    "Microsoft .NET Framework 3.5 Service Pack 1 and .NET Framework 3.5 Family Update (KB951847) x86" to get a complete reinstall of 2.0 thru 3.5 lacking only as few updates since the family update.  This family update will appear as available after using cleanup tool for removal.

Page 4 of 35 (518 items) «23456»
Leave a Comment
  • Please add 5 and 5 and type the answer here:
  • Post