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
  • I installed Advanced System Optimizer in Windows 8(x86). It automatically downloaded & installed .net framework v3.5. And there is no option to uninstall the .net framework. If i want to remove ASO and uninstall the .net framework v3.5, can i use this tool? Will it remove successfully?

  • Hi Zu - The .NET Framework 3.5 is included as a part of Windows 8.  You can find instructions for how to enable and disable the .NET Framework 3.5 on Windows 8 at msdn.microsoft.com/.../hh506443.aspx.

  • I forgot and i got it from the same link when i browsed MS answers. Anyway thnx for reply. It might be useful for other users.

  • Thankx

  • سلام به همه!

    منم مثل شما گیر کرده بودم دارم اینو دانلود میکنم!

    من خودم قبلش فایلشواز درایو c

    پاک کردم الان داره نصب میشه اگه نشد اینو امتحان کنید

    ششششششششششششییییییییییییییییییر ایرانی!

  • Hi Aaron,

    I get the unhandled exception error. root element is missing. When I open Microsoft Health vault connection center. here are details of error.

    See the end of this message for details on invoking

    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************

    System.Xml.XmlException: Root element is missing.

      at System.Xml.XmlTextReaderImpl.Throw(Exception e)

      at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)

      at System.Xml.XmlTextReaderImpl.ParseDocumentContent()

      at System.Xml.XmlTextReaderImpl.Read()

      at System.Xml.XmlTextReader.Read()

      at System.Xml.XmlReader.MoveToContent()

      at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSourceSettings.Read8_ArrayOfSourceSetting()

    ************** Loaded Assemblies **************

    mscorlib

       Assembly Version: 2.0.0.0

       Win32 Version: 2.0.50727.5466 (Win7SP1GDR.050727-5400)

    ConnectionCenter

       Assembly Version: 4.0.2720.6410

       Win32 Version: 4.0.2720.6410

       CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20HealthVault/Connection%20Center/ConnectionCenter.exe

    Microsoft.Health.ClientCS

       Assembly Version: 4.0.2720.6410

       Win32 Version: 4.0.2720.6410

       CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20HealthVault/Connection%20Center/Microsoft.Health.ClientCS.DLL

    System.Windows.Forms

       Assembly Version: 2.0.0.0

       Win32 Version: 2.0.50727.5468 (Win7SP1GDR.050727-5400)

       CodeBase: file:///C:/windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

    System

       Assembly Version: 2.0.0.0

       Win32 Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400)

       CodeBase: file:///C:/windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

    System.Drawing

       Assembly Version: 2.0.0.0

       Win32 Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400)

       CodeBase: file:///C:/windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

    Microsoft.Health.Client

       Assembly Version: 4.0.2720.6410

       Win32 Version: 4.0.2720.6410

       CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20HealthVault/Connection%20Center/Microsoft.Health.Client.DLL

    Any help welcome.

    Thanks

    Peter

  • Hi peterpi - It sounds like an XML file required by HealthVault is either missing or has incorrect data in it.  I can't tell from this error message which XML file it is referring to though.  It might help to try to repair/re-install HealthVault.  If that doesn't help, then you might want to post a question on the HealthVault forums at social.technet.microsoft.com/.../HealthVaultCustomer to see if someone there can provide any additional suggestions.

  • does not uninstall .net on windows premium, x64((

  • Hi does not uninstall .net - The cleanup tool does not allow you to remove a version of the .NET Framework that is installed as a part of the Windows operating system.  What exact version of Windows is on your computer (Windows 7, Windows 8, etc), and what version(s) of the .NET Framework are you trying to fix?

  • Thanks for posting this.  I attempted to use the tool to repair .Net 4.5 on Windows 8, but realized that the cleanup tool doesn't remove versions included as a part of the OS.  I'm having significant issues with .Net 4.0 and 4.5 and would like to repair them.  Any advice?

  • Hi Rob - Here are the steps that I suggest to try to repair versions of the .NET Framework that are installed as a part of Windows:

    1.  Install the latest Windows service pack if you haven't yet.

    2.  Try to run the System Update Readiness Tool from support.microsoft.com/.../947821.

    3.  Try to repair the files that are a part of your OS by using the steps listed at blogs.msdn.com/.../how-to-repair-the-net-framework-2-0-and-3-0-on-windows-vista.aspx.

    If none of the above help, you might need to repair/re-install Windows to fix this type of error.  It might also help to post a question on one of the Windows forums to see if someone there has any additional suggestions for you to try before you resort to re-installing Windows.

  • Thank you :)

  • [08/01/13,12:14:15] ****ERROR**** Process 'C:\Windows\system32\msiexec.exe /x {F5B09CFD-F0B2-36AF-8DF4-1DF6B63FC7B4} /qn' exited with return code 1641

    I see not reference for a code 1641.

  • Hi Aaron,

    I have XP Professional SP3 and use auto update. This particular update:

    "Security Update for Microsoft .NET Framework 1.1 SP1 on Windows XP, Windows Vista, and Windows Server 2008 x86 (KB2833941)"

    Fails and re-attempts every time I shutdown and re-boot. It also corrupts a driver for a USB to VGA device in the process requiring a reinstall for my second monitor.

    So, I followed instructions:

    "Uninstall .NET Framework 1.1. Then download the .NET Framework Cleanup Tool

    From the drop-down box, select 1.1 and clean.

    Reinstall .NET Framework 1.1

    Download and install .NET Framework 1.1 Service Pack 1

    Visit Windows Update or Microsoft Update and let it install the rest of the 1.1 updates including KB2833941."

    When I attempt to install SP1 I get the following error, also when I boot. “c:\windows\microsoft.net\framework\v2.0.50727\mscorworks.dll could not be loaded”

    I also attempted to fix with the Microsoft .NET Framework Repair Tool. to no avail.

    I attempted to uninstall .NET Framework 2 SP2 which was a suggested solution, but I got a message that I couldn't.

    At this point I am at a complete loss as to what to do as my research has not uncovered any viable options. Do you have any suggestions other than re-installing Windows?

    Thanks,

    Jim

  • Hi Don - Error code 1641 is a Windows Installer error code that means that the install/uninstall operation was successful and a reboot is required.  You can find more information about that error code at support.microsoft.com/.../290158.

    You should be able to safely proceed with removal and re-install of the .NET Framework after getting that error code.

Page 27 of 36 (537 items) «2526272829»
Leave a Comment
  • Please add 7 and 5 and type the answer here:
  • Post