views:

134

answers:

1

Should I wrap all the files I want to install in individual components? What is the advantage of putting several files in one component?

+1  A: 

One reason for "one file per component" is resiliency. When an application is started, Windows Installer can check whether the keypath of any component is missing. If the keypath is missing, the component is reinstalled/repaired.

If a component has multiple files, then only one file can be the keypath. In wix you you indicate this by setting KeyPath=yes on a File element. The other files will then not be fully protected by Windows Installer resiliency. They will only be reinstalled if the keypath file goes missing.

Another reason to have "one file per component" is when installing files to locations where they may already be present (e.g. an application upgrade, or when installing to c:\windows\system32). Windows installer determines whether a component needs to be installed by checking the keypath. If the keypath is a file and the file is already there (with the same version or higher) then the component is not installed. That's a problem if the other files in the component actually needed to be installed/upgraded.

Wim Coenen
This is a great answer but doesn't say why the reverse is useful. Which is reasonable, as I only know of one advantage: you save some registration time during installation, as each component is registered, but each of its files is not. This is generally not a good tradeoff, as it kills resiliency and hinders upgrades, so pay more attention to wcoenen's recommendation.
Michael Urman

related questions