Thursday, February 21, 2008

Microsoft ate my uninstaller

Summary: Microsoft thinks that program uninstall shortcuts under the Start menu are bad. What say you?

The most common methods of uninstalling software include two options:
  1. the Add or Remove Programs Control Panel (or an equivalent program), or
  2. a shortcut under the Start menu's program group (or Uninstall shortcut).
Although many programs create Uninstall shortcuts, Microsoft discourages this practice. In Designed for Windows XP Application Specification, Microsoft suggests:
"Do not place shortcuts to remove the application in the Start menu. It is not needed because your application’s uninstaller is in the Add or Remove Programs Control Panel item." (Section F1.1)
In addition to the stated reason, Microsoft does not favor Uninstall shortcuts because they (supposedly) add clutter to the Start menu:
"Usability studies show that when the Start menu and/or Windows Desktop become too cluttered, users have a very difficult time finding and launching their programs. This leads to a bad user experience." (Section F1.1)
I don't buy the last argument because when users complain about the Start menu clutter, they probably imply the main Programs group folder. Since Uninstall shortcuts appear under the application sub-folders (and not directly under the main Programs group folder), they do not make the Programs group folder more cluttered than it already is. Besides, with Vista improvements and so many available alternatives, Start menu clutter becomes less of an issue. [After adopting Launchy, I hardly use the Start menu.]

With respect to the "application’s uninstaller [being] in the Add or Remove Programs Control Panel" argument, I have to mention that the Add or Remove Programs Control Panel... kinda... sucks! Let's see what it takes to uninstall a program via the Uninstall shortcut and compare it to the Add or Remove Programs approach.

Option 1: Use the Uninstall shortcut
  1. Click the Start menu; select Programs-Application folder-Uninstall.
  2. Follow the prompts.
This was fast. Now, how do we get to the same step via the Add or Remove Programs control panel:

Option 2: Use Add or Remove Programs
  1. Click the Start menu; select Settings-Control Panel.
  2. Wait a few seconds (minutes) for Control Panel to load.
  3. Control Panel loads. Select (or double-click) the Add or Remove Programs option.
  4. Wait for the list (of installed applications) to be populated. (Go to Starbucks... Get a cup of Frappuccino... Come back...)
  5. OK, the Add or Remove Programs list is finally populated. Now, find the application. (Scroll down looking for the application name... Scroll up looking for the software maker name... It is not uncommon for the entries in the Add or Remove Programs control panel to have names different from the applications under the Start menu. Sometimes the Add or Remove Programs Control Panel contains entries with duplicate names.)
  6. Once you find a reasonable match, select the program and click the Uninstall button.
  7. Follow the prompts.
Although the performance of the Add or Remove Programs Control Panel in Windows Vista has somewhat improved, it's still not the most efficient way of removing software. Maybe this is why a number of applications, including CCleaner, MyUninstaller, Revo Uninstaller, and ZSoft Uninstaller, promise to offer a better uninstallation experience. [After trying a few of these alternatives, I have not been convinced that their application removal features offer any drastic improvements over the Add or Remove Programs Control Panel.]

Not only does it take longer to launch uninstaller from the Add or Remove Programs Control Panel, but what would you do if Control Panel stopped working. This happened to me a few times. For example, a couple of weeks ago I installed a recommended anti-virus tool, and several programs -- including the Add or Remove Programs Control Panel -- started to malfunction (I could not even launch the Add or Remove Programs Control Panel). Attempts to kill or suspend the offending application process did not help, but because the application had the Uninstall shortcut, I could quickly remove it and bring my system back to normal. Without the Uninstall shortcut, fixing the problem would've taken much longer.

If you want to implement the Uninstall shortcut for your application, but not sure how, check Google (look for the solution applicable to your installer technology). For MSI-based installations, use a shortcut with the following command line (replace Product_Code_GUID with the actual value of ProductCode):

msiexec /x{Product_Code_GUID}
To implement an Uninstall shortcut in a Visual Studio 2005 deployment project, do the following:
  1. Add Windows system folder

    Select the setup project in Solution Explorer, click the File System Editor icon. Right-click anywhere (except the currently displayed folders) in the File System Editor view, and select the Add Special Folder - System Folder to project menu option.

  2. Add msiexec.exe file to project

    In File System Editor, right-click System Folder, and select the Add - File... menu option.


    In the Add Files dialog box, select the msiexec.exe file located in the Windows system folder (such as System32) and click the Open button.

  3. Create the Uninstall shortcut

    Double-click the application folder under the User's Programs Menu and right-click anywhere on the empty space of the right panel of the File System Editor (make sure that none of the items are selected); select the Create New Shortcut menu option.


    In the Select Item in Project dialog box, double-click System Folder, and select msiexec.exe; click OK.

  4. Set the Uninstall shortcut properties

    Select the Uninstall shortcut and press the F4 key to display the shortcut properties window. Rename the Uninstall shortcut to something more meaningful, like Uninstall (it may make sense to include the name of your application). Set the value of the Arguments property to /x[ProductCode] (you can enter the GUID of the product code, but then you would need to remember to update the shortcut property if you change the GUID).

Note: When you build the setup package, you will get the following warning (the path to the msiexec.exe file may be different):
WARNING: 'msiexec.exe' should be excluded because its source file 'C:\WINDOWS\system32\msiexec.exe' is under Windows System File Protection.
You can ignore this warning.

Additional references:
Application Specification for Microsoft Windows 2000 Server
Application Specification for Microsoft Windows Server 2003
Dude, where is your installer?

9 comments:

  1. Oh! so you are also one of the people who believe that those uninstaller programs are of no use! Glad that someone thinks the way I think.

    I completely agree to you as far as having a extra shortcut of uninstall with every program. I hate to open Add/Remove app as that loads damn slow.

    And I'll suggest you to use Key Launch instead of Launchy :)

    ReplyDelete
  2. As they say, "Great minds think alike." ;-) I've been pretty happy with Launchy, but will check out Key Launch (somehow I never heard of it). Thanks for the comment.

    ReplyDelete
  3. ReviewSaurus: BTW, what makes you prefer Key Launch to Launchy? After checking other people's comments, I didn't see the killer features which would make it better. I thought I would find a review on you site (blog), but did not find one. (blink, blink ;-) )

    ReplyDelete
  4. Hi mister,

    my production PC is Windows 2003; development environment: using VS 2005 in Windows XP for create Setup Project



    I need copy dll (C runtime DLL msvcr71.dll) to windows\system32 directory.

    In other forums:

    " If you are creating a setup and deployment project in Visual Studio, it
    is quite simple: just open the File System Editor, select the option to add
    a special folder, add the system32 folder, and drag your dll to that folder.
    The dll wil be compressed into the .msi; you don't need to do anything to
    embed it into your deployment project."



    Now, how I test if the dll is installed yet ?? Can I add any condition anyway in Setup Project ??
    The test will be like if !File.Exists("c:\windows\system32\mscrv71.dll")



    Thanks in advance and greetings. Your help is very grateful.

    Please send me email to notification new posts to answer my question. Thanks.

    enrique.prados@a-e.es

    ReplyDelete
  5. VC runtime may contain more than one DLL (msvcrt71.dll), so I would not recommend installing the file manually (and there are more reasons not to do this). Please check out the following MSDN article: Redistributing Visual C++ Files (it covers VC 8 runtime, but you should be able to use a similar approach for VC 7 runtime).

    ReplyDelete
  6. Thank you very much Mr Alek Davis !! I found this VERY usefull =)

    ReplyDelete
  7. Alek

    Just wondering if you would know anything about the following :
    MSI uninstall runs smoothly but fails to actually uninstall the application (ie; remove files, custom actions etc).
    This happens only when the product is installed in Non Default Location.

    in the log i found the following:
    MSI (s) (B8:3C) [11:38:45:193]: PROPERTY CHANGE: Modifying TARGETDIR property. Its current value is 'C:\Program Files\MYAPP'. Its new value: 'C:\Program Files\MYAPP\'.

    Where as the product is actually installed at f:\MyApp\

    ReplyDelete
  8. This would be hard to troubleshoot without actually looking at code. I would check the behavior when uninstalling from both Control Panel's Add/Remove Programs and shortcut. If it works from the Add/Remove Programs but not from the shortcut, then this must be an issue with malformed command line. If it does not work from Add/Remove Programs, it must be a fundamental issue (probably in the installer).

    ReplyDelete
  9. i take it back. it seems to work on a clean system. Looks like my dev machine has some leftovers causing this unclean removal.

    thanks

    ReplyDelete