Partilhar via


Mailbag: How to perform a silent repair and uninstall of the .NET Framework 3.5

Question:

A while back, you posted a set of instructions that can be used to perform silent or unattended repairs and uninstalls for the .NET Framework 2.0 SP1 and the .NET Framework 3.0 SP1.  I would like to automate the repair and uninstall for the .NET Framework 3.5 as well.  How can I do that?

Answer:

The .NET Framework 3.5 installs a copy of its setup files to the folder %windir%\Microsoft.NET\Framework\v3.5\Microsoft .NET Framework 3.5, and this location is the one that is launched when you go to Add/Remove Programs and choose to repair or uninstall the .NET Framework 3.5.  The setup.exe in this location can also be called directly in order to automate the repair or uninstall of the .NET Framework 3.5.

The following command lines can be used to repair and uninstall the .NET Framework 3.5.  The silent option will perform the repair/uninstall with no UI displayed to the user.  The unattended option will perform the repair/uninstall with only a progress dialog, but with no user interaction required.

.NET Framework 3.5 - silent repair

"%windir%\Microsoft.NET\Framework\v3.5\Microsoft .NET Framework 3.5\setup.exe" /q /norestart

.NET Framework 3.5 - unattended repair

"%windir%\Microsoft.NET\Framework\v3.5\Microsoft .NET Framework 3.5\setup.exe" /qb /norestart

.NET Framework 3.5 - silent uninstall

"%windir%\Microsoft.NET\Framework\v3.5\Microsoft .NET Framework 3.5\setup.exe" /q /uninstall /norestart

.NET Framework 3.5 - unattended uninstall

"%windir%\Microsoft.NET\Framework\v3.5\Microsoft .NET Framework 3.5\setup.exe" /qb /uninstall /norestart

Note:   There are a few things to keep in mind about the above instructions:

  • When calling .NET Framework 3.5 setup in silent or unattended mode, you should check the return code from the setup.exe process in order to determine success or failure.  Return code 0 means that the setup was successful, return code 3010 means that the setup was successful but a reboot is required to complete the setup and any other return code means that there was an error.
  • Log files will be created for the .NET Framework 3.5 repair and uninstall just like for the initial install.  You can find a list of .NET Framework 3.5 log files in this blog post.
  • The .NET Framework 3.5 repair process will chain the repair processes for the .NET Framework 2.0 SP1 and the .NET Framework 3.0 SP1, so there is no need to use separate steps to repair those products if you are going to repair the .NET Framework 3.5.
  • The .NET Framework 3.5 uninstall process will only uninstall the .NET Framework 3.5 MSI.  It will not uninstall the .NET Framework 2.0 SP1 or the .NET Framework 3.0 SP1 products because there may be other applications on the system that rely on those versions of the .NET Framework.  If you want to uninstall the .NET Framework 2.0 SP1 and 3.0 SP1, you must uninstall in the following order:  .NET Framework 3.5, then .NET Framework 3.0 SP1 then .NET Framework 2.0 SP1.

Comments

  • Anonymous
    July 03, 2008
    The comment has been removed

  • Anonymous
    March 04, 2009
    Question: I have seen your blog posts that describe how to silently repair and uninstall the following

  • Anonymous
    August 21, 2010
    For some reason setup.exe is not found in C:WindowsMicrosoft.NETFrameworkv3.5     How do I reinstall the 3.5 framework on Windows 7  ?   If setup.exe is missing from this folder, can it still be repaired?

  • Anonymous
    August 22, 2010
    The comment has been removed