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?

Friday, February 1, 2008

Dude, where is your installer?

Summary: Don't make your application users suffer: offer them an installer.

Last year, Jeff Atwood wrote an article, in which he mentioned a hassle of installing applications, which do not have installers. After describing the manual steps it takes to prepare such application for its first run, Jeff concluded:
"That's a lot of tedious, error-prone steps I have to perform before I can run the application. [...] Is this really what we want to subject our users to?"
Judging by the growing number of applications, which come without installers, the answer to Jeff's question is: "Absolutely!" And not only do we (programmers) want to subject our users to these tedious, error-prone steps, we somehow managed to make them believe that this is a good thing. Read what CyberNet's Ryan wrote about an application called Pitaschio:
"[Pitaschio] caught my attention not only because it was freeware, but also because it didn’t require any installation. Those two ingredients are pretty important when it comes to making a good first impression on me."
Now, Ryan, wait a minute... It didn't require any installation? Are you sure?

With the exception of portable programs (such as Portable Apps intended to run from USB drives), any application requires some form of installation. Installation can be manual (extracting files from a ZIP file, copying them to folders, creating shortcuts) or it can be done with the help of a setup program. Whenever someone claims that an application does not require any installation, he (she) probably means that the application does not have an installer and must be set up manually. Why this is considered a good thing is beyond me because it normally takes more effort to install a program manually.

Let's compare the steps it takes to install a hypothetical program consisting of a single executable file with and without an installer.

Option 1: Installation steps (with installer)
  1. Download the ZIP file.
  2. Extract installer file(s) from the ZIP file (to a temporary folder) and launch the setup program (good installers do this in one step).
  3. Once the setup program starts, click the Next button to select the default options (for the application folder, and so on) until setup completes (most installations can be done in three clicks or less without lots of thinking).
  4. (Optional) Delete setup file(s) from the temporary folder (again, good installers do this automatically).
  5. Delete the ZIP file.
The key point here is that the user is not forced to think and can just go: click, click, click (the mouse), or hit, hit, hit (the Enter button). Here are the steps, which I often perform to install a program manually.

Option 2: Installation steps (without installer)
  1. Download the ZIP file.
  2. Extract the application file from the ZIP file to... Hmm, where should it go? (Thinking...) I guess, I'll save it under the Program Files folder.
  3. Open Windows Explorer (click, click to start Windows Explorer). Locate the Program Files folder (click, click, click, more clicks to navigate to the Program Files folder).
  4. Okay, I'm in the Program Files folder, but how do I name a folder for the new app? (Thinking...) I guess, I'll name it after the application executable. Select File-New-Folder from the menu, enter the name of the new folder, hit Enter.
  5. Extract the application executable to the newly created folder.
  6. Switch back to the application folder in Windows Explorer and create a shortcut (right-click the executable, select Create Shortcut from the menu, click F2 to rename the shortcut, enter a more user-friendly name, hit Enter).
  7. Create a new program folder under the Start menu (click, click, click, more clicks to navigate to the Programs folder under the Start menu, select File-New-Folder, enter the name of the new folder, hit Enter).
  8. Copy the application shortcut to its program folder under the start menu.
  9. (Optional) To auto-start the program, copy its shortcut to the Startup folder; otherwise, copy the shortcut to the Quick Launch menu (again a few more clicks).
  10. Delete the ZIP file.
Would someone (Ryan?) be so kind to explain what makes option 2 better than option 1, because it's not obvious.

One argument in favor of installer-free applications claims that these applications are easy to uninstall: just delete the application file(s) and it's gone. I can't agree with this argument because it attributes "clean" application behavior (the fact that the application does not use Windows registry or any other persistent storage) to lack of installer. Besides, most client programs rely on persistent storage for tasks such as storing application data and user preferences, which (according to the most recent guidelines) should not be kept in the program folder, but saved in the user's application data directory (such as AppData). This means that when uninstalling the program, I need to find and manually delete data files, as well as the program file(s) and shortcuts located in various folders (Program Files, AppData, desktop, Start menu, Startup folder, Quick Launch menu). Again, how is this easier than launching the uninstaller and letting it handle all cleanup tasks for me?

There is one valid argument in favor of installer-free programs: support for portable execution. If an application is intended to run from a portable device, such as a USB drive, it should not require an installer. However, this does not mean that the application should not provide an installer for regular (non-portable) use.

Smarter developers, such as the makers of my favorite text editor PSPad, offer users both installation options: with and without installers. I hope that one day I will see installers for other great programs, including:If you are a developer, who haven't written an installer before, you may not realize that (for simple applications) it requires very little effort. You can build a simple installer using Visual Studio's Setup and Deployment Project templates. Or use one of the following FREE tools:Lists of other installer authoring tools can be found here:If you are totally new to the world of installers, the following references will help you get started:

Build an Installer for Installer-less Programs
Deploying a Windows-based Application
How to create a Setup package by using Visual Studio .NET
Step-by-Step Process of Creating a Setup and Deployment Project
More articles...

See also:
From MSI to WiX
It's the installation, stupid
Software and Support for Setup Developers
Windows Installer resources
Installers (list of free and commercial installers)