Source Resolution during Patch Uninstall

There are a number of guidelines to prevent requiring source media for patch installation. These guidelines can also help prevent requiring source media during patch uninstall, but there are a number of caveats.

Recall from Rebuilding the Installer Cache that the baseline cache contains files that were replaced. But files that get replaced don’t always get copied to the baseline cache. When uninstalling the patch, since these files aren’t in the baseline cache, the original source media is required. If the source media isn’t available in the registered cache locations, a prompt during UI installs will occur or the installation will fail during silent installations.

A file may not be cached in the baseline for a number of reasons:

  1. A file was updated in the patch (the Attributes column in the File table included the msidbFileAttributesPatchAdded (0x1000) attributed) but the file on disk was identical and unmodified. When the patch is uninstalled, Windows Installer will attempt to reinstall the original file because the patch file is being removed.
    1. This could be caused by another patch – perhaps even for another product – that already updated the file.
    2. This could also be caused by a file being included in the patch that is not actually updated from the target from which the patch was built.
  2. Native assemblies are installed using the MsiAssembly and MsiAssemblyName tables. Windows Installer delegations to fusion (fusion.dll for managed assemblies; sxs.dll for native assemblies) to install files, but fusion cannot report back the manifest and catalog locations. Sine these locations are unknown to Windows Installer, it cannot cache these files in the baseline.

There’s quite a bit of information available in a verbose installation log, but for specific reasons why a file isn’t cached in the baseline cache you must enable debug logging as well, by passing the “x” parameter to the logging command switch for Windows Installer 3.0 and newer, such as in the following example:

msiexec.exe /i {BDEFF59A-9751-4023-BEDB-F6501B97ACA2} /L*vx patch.log PATCH=example.msp

You can also set the debugging system policy in addition to the logging system policy.

After the final patch application order, you will find that file information is saved for files that will be replaced. During CostInitialize the baseline caches and files are enumerated, and during InstallFinalize (or whenever deferred actions are run for InstallFiles and related actions) you’ll find operations to perform the actual baseline caching. Each will precede the file copy operations, so if there is no baseline caching operation logged for a file before a file copy operation, the file has not been cached for that product and uninstalling the patch must resolve source, which you’ll see logged starting with “Resolving Source” in a verbose log.