July 3rd, 2009

Installation sequence restrictions for multi-package transactions

Heath Stewart
Principal Software Engineer

Windows Installer 4.5 introduced a feature to install multiple packages in a single transaction. Multi-package transactions allow setup developers to install multiple packages as an atomic unit that are installed together, or rolled back completely. You can also apply patches to multiple products or even repair multiple products – any maintenance mode installation – within a single transaction. Installation scripts are not merged but executed in the order that packages are installed, and commit actions are deferred till the very end.

There is an installation sequence restriction, however: if you are installing both 32- and 64-bit packages – marked in the Template summary property of an MSI package – you must install the 64-bit packages first before the 32-bit packages.

Within a single transaction, if you install a 32-bit package and then a 64-bit package, any attempts to install files to 64-bit directories like ProgramFiles64Folder will be redirected as highlighted below.

    ******* Product: x86.msi

MSI (s) (3C:4C) [22:35:38:008]: Running installation inside multi-package transaction MultiMsi 

MSI (s) (3C:F4) [22:35:45:821]: Target path resolution complete. Dumping Directory table...
MSI (s) (3C:F4) [22:35:45:822]: Note: target paths subject to change (via custom actions or browsing)
MSI (s) (3C:F4) [22:35:45:831]: Dir (target): Key: TARGETDIR    , Object: C:
MSI (s) (3C:F4) [22:35:45:831]: Dir (target): Key: ProgramFilesFolder    , Object: C:Program Files (x86)
MSI (s) (3C:F4) [22:35:45:841]: Dir (target): Key: ManufacturerDir    , Object: C:Program Files (x86)Heath Stewart
MSI (s) (3C:F4) [22:35:45:849]: Dir (target): Key: INSTALLLOCATION    , Object: C:Program Files (x86)Heath StewartMultiMsi (x86) 

    ******* Product: x64.msi

MSI (s) (3C:4C) [22:35:48:404]: Running installation inside multi-package transaction MultiMsi 

MSI (s) (3C:38) [22:35:48:793]: WIN64DUALFOLDERS: 'C:Program Files (x86)' will substitute 17 characters in 'C:Program Files' folder path. (mask argument = 0, the folder pair's iSwapAttrib member = 0).
MSI (s) (3C:38) [22:35:48:793]: PROPERTY CHANGE: Modifying ProgramFiles64Folder property. Its current value is 'C:Program Files'. Its new value: 'C:Program Files (x86)'.

MSI (s) (3C:38) [22:35:48:797]: Target path resolution complete. Dumping Directory table...
MSI (s) (3C:38) [22:35:48:798]: Note: target paths subject to change (via custom actions or browsing)
MSI (s) (3C:38) [22:35:48:799]: Dir (target): Key: TARGETDIR    , Object: C:
MSI (s) (3C:38) [22:35:48:799]: Dir (target): Key: ProgramFiles64Folder    , Object: C:Program Files (x86)
MSI (s) (3C:38) [22:35:48:800]: Dir (target): Key: ManufacturerDir    , Object: C:Program Files (x86)Heath Stewart
MSI (s) (3C:38) [22:35:48:801]: Dir (target): Key: INSTALLLOCATION    , Object: C:Program Files (x86)Heath StewartMultiMsi (x64)

You can see the Windows Installer is redirecting ProgramFiles64Folder to ProgramFilesFolder. Files intended for 64-bit locations end up in 32-bit locations. However, if you reverse the sequence of packages to install the 64-bit package first before the 32-bit package, the directories are resolved correctly as shown below.

    ******* Product: x64.msi

MSI (s) (F4:CC) [22:39:19:277]: Running installation inside multi-package transaction MultiMsi

MSI (s) (F4:70) [22:39:21:325]: Target path resolution complete. Dumping Directory table...
MSI (s) (F4:70) [22:39:21:353]: Note: target paths subject to change (via custom actions or browsing)
MSI (s) (F4:70) [22:39:21:361]: Dir (target): Key: TARGETDIR , Object: C:
MSI (s) (F4:70) [22:39:21:375]: Dir (target): Key: ProgramFiles64Folder , Object: C:Program Files
MSI (s) (F4:70) [22:39:21:407]: Dir (target): Key: ManufacturerDir , Object: C:Program FilesHeath Stewart
MSI (s) (F4:70) [22:39:21:430]: Dir (target): Key: INSTALLLOCATION , Object: C:Program FilesHeath StewartMultiMsi (x64) 

    ******* Product: x86.msi

MSI (s) (F4:CC) [22:39:25:502]: Running installation inside multi-package transaction MultiMsi

MSI (s) (F4:FC) [22:39:25:896]: Target path resolution complete. Dumping Directory table...
MSI (s) (F4:FC) [22:39:25:896]: Note: target paths subject to change (via custom actions or browsing)
MSI (s) (F4:FC) [22:39:25:897]: Dir (target): Key: TARGETDIR , Object: C:
MSI (s) (F4:FC) [22:39:25:898]: Dir (target): Key: ProgramFilesFolder , Object: C:Program Files (x86)
MSI (s) (F4:FC) [22:39:25:898]: Dir (target): Key: ManufacturerDir , Object: C:Program Files (x86)Heath Stewart
MSI (s) (F4:FC) [22:39:25:899]: Dir (target): Key: INSTALLLOCATION , Object: C:Program Files (x86)Heath StewartMultiMsi (x86)

To install components into their right directories, you must install 64-bit packages first before 32-bit packages. If you have a functional requirement to install the 32-bit packages first you must do so in a separate transaction and simulate rollback yourself: you must uninstall packages from previous transactions.

Author

Heath Stewart
Principal Software Engineer

Heath is an application architect and developer, looking to help educate others to learn professional development. Besides designing and developing applications he enjoys writing about intermediate and advanced topics. Heath also consults for deployment packages and scenarios within Microsoft and for external customers.

0 comments

Discussion are closed.