Question

Why does the Windows Installer log list apparently duplicate components prepended with double underscore and appended with 65? Example:
Action start <time>: InstallValidate. 
MSI (s) <process info>: Feature: Simple; Installed: Absent; Request: Local; Action: Local 
MSI (s) <process info>: Component: Simple7890123456789012345678901234567890123456789012345; Installed: Absent; Request: Local; Action: Local 
MSI (s) <process info>: Component: __Simple789012345678901234567890123456789065; Installed: Null; Request: Local; Action: Local

Answer

Windows Installer performs disk costing to determine the amount of space required for the setup. It associates cost at the component level. The cost associated to an individual component is based upon the files that it installs and the Directory_ reference. However, there are cases where a component can actuall install resources into locations other than the Directory_ reference. In order to account for that, and to more accurately adjust costing when a Directory location changes (such as when the user alters the InstallLocation), the Installer uses a mechansim called cost-linking. For each alternate directory for the component, the Installer creates a new temporary component, called a subcomponent. The format of the component is a double under bar prefix (__) followed by the first 40 characters of the component name followed by a number.

Cost-Linking is used to account for the following tables:

  • Shortcut
  • RemoveFile
  • MoveFile (both source and destination folders)
  • DuplicateFile
  • Registry
  • IniFile
  • ReserveCost
Cost-linking is also used for all global/shared assembly components (both urt and win32) and for the new MSI 3.X baseline cache management for patched files (only when a new patch is applied).

So, for example, let's look again at the InstallValidate action dump from above for an example setup where the component installs both a file and a registry key:

Action start <time>: InstallValidate. 
MSI (s) <process info>: Feature: Simple; Installed: Absent; Request: Local; Action: Local 
MSI (s) <process info>: Component: Simple7890123456789012345678901234567890123456789012345; Installed: Absent; Request: Local; Action: Local 
MSI (s) <process info>: Component: __Simple789012345678901234567890123456789065; Installed: Null; Request: Local; Action: Local
Note the subcomponent highlighted in red. That component was created to account for cost associated with the registry key. It's a cost-linked component for the component + WindowsFolder directory. The component's current cost (for the parent) is associated with the SimpleDir directory which is the authored directory for the component in the Component table. At this point, the component doesn't have any previously created child components so it starts with a suffix of 65. Also, only the first 40 characters were used of the component name (which had 55 characters).

Content credit also belongs to

[Author: Robert Flaming]
This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm.