One file per component or several files per component?

落花浮王杯 提交于 2019-11-26 10:17:50

问题


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:


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 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.




回答2:


I follow the Microsoft approach which is also used by InstallShield: http://msdn.microsoft.com/en-us/library/aa368269(VS.85).aspx

The above link gives the advantages of this approach.

The relevant part is:

  1. Define a new component for every .exe, .dll, and .ocx file. Designate these files as the key path files of their components.


来源:https://stackoverflow.com/questions/1602831/one-file-per-component-or-several-files-per-component

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!