How to workaround .NET Framework 2.0 OS component uninstall failure on Windows Server 2003 R2

As I previously described in this blog post, the MSI-based .NET Framework 2.0 is included as an optional OS component on Windows Server 2003 R2.

The .NET Framework 2.0 service pack 1 is designed to be a slipstreamed package behind the scenes.  If it is installed on a system that has the original release of the .NET Framework 2.0 installed, the .NET Framework 2.0 SP1 will perform a major upgrade of the original release of the .NET Framework 2.0, which means that it will uninstall the original 2.0 MSI and then installs the new 2.0 SP1 package.

Because of the architecture of the .NET Framework 2.0 SP1 setup, if it is installed on a Windows Server 2003 R2 system that has the .NET Framework 2.0 optional OS component installed, it will essentially replace the optional OS component.  If you try to go back to the Add/Remove Windows Components control panel and uninstall the .NET Framework 2.0 optional OS component after installing the .NET Framework 2.0 SP1 (or a product that includes the .NET Framework 2.0 SP1 like the .NET Framework 3.5), that uninstall will fail.  This happens because the command line that Windows Server 2003 R2 uses to uninstall the .NET Framework 2.0 is specific to the initial release of the .NET Framework 2.0, and that command line no longer works for the .NET Framework 2.0 SP1 setup package.

If you encounter this uninstall error for the .NET Framework 2.0 optional OS component on Windows Server 2003 R2, you can uninstall the .NET Framework 2.0 SP1 using the separate .NET Framework 2.0 SP1 entry in Add/Remove Programs instead of using the Add/Remove Windows Components control panel.

Keep in mind that you will not be allowed to uninstall the .NET Framework 2.0 SP1 if you have the .NET Framework 3.0 SP1 or the .NET Framework 3.5 installed.  In that case, you need to first uninstall the .NET Framework 3.5, then uninstall the .NET Framework 3.0 SP1.  After that, you will be allowed to uninstall the .NET Framework 2.0 SP1 using its entry in Add/Remove Programs.