Reinstalling a Feature or Application

[This is preliminary documentation and subject to change.]

Microsoft® Windows® installer can repair, replace, and verify files contained in an application. A partial or complete application reinstallation might be required if any files or registry entries associated with any feature have become corrupted or are missing.

The following list contains several means of reinstalling a feature or product. The first two methods have been automated by the installer.

For more information on reinstalling a feature or application, see Resiliency.

    To reinstall a product using the installer
  1. Call MsiReinstallProduct.
    To reinstall a feature using the installer
  1. Call MsiReinstallFeature.
    To reinstall a product or feature with an installer user interface
  1. Add a button to the specified dialog box by adding an entry to the Control table.
  2. Add a ReinstallMode ControlEvent to the ControlEvent table, with the Dialog_ and Control_ fields referencing the button control you created in step 1. In the Argument field, enter a string containing the letters corresponding to the reinstall modes you want (the acceptable values for this field are identical to those accepted for the ReinstallMode property). The value in the Ordering column for this event should be 1.
  3. Add a Reinstall ControlEvent event to the ControlEvent table, again referencing the same button control. The Argument field for this event will normally be "ALL", to force reinstallation of all features, but you can place the name of a specific feature here. The value in the Ordering column for this event should be 2.
  4. Add one more event tied to the same button control, to actually initiate the reinstallation. This can be an EndDialog event (with an argument of Return). More typically, however, a NewDialog event would be used here to jump to an Are you sure you want to reinstall? confirmation dialog box. The value in the Ordering column for this event should be 3.

    If desired, several Reinstall buttons can be created for a single dialog box, allowing the user to select the type of reinstallation performed. In this case, each button is authored as outlined in the preceding procedure, with a different ReinstallMode ControlEvent parameter for each button.

    To reinstall a product or feature from a command line

Once a particular product has been installed (with some or all of the product's features), a reinstallation can be performed on the command line.

  1. From the command prompt, specify the REINSTALL property.
  2. From the command prompt, specify the REINSTALLMODE property.

    Specifying these properties allows the user to reinstall any or all of the product's features. The type of reinstallation can also be specified. For example, you can specify that only those files that are totally missing should be reinstalled, or that only corrupted files (for example, any executable file whose checksum doesn't match the actual file contents) be replaced. Alternatively, you can specify that the fitness of the current installation be verified, without actually repairing any broken or missing files/registry entries. In this case, for all installed features, the installer reports (typically in a log file) the results of any verification that you specify, such as whether there are any missing or corrupt files, any files of the wrong version, or any missing or incorrect registry entries. At any later time, you can then run the installation again to repair any or all of the detected problems.