After reading this answer on "one file per component" approach when using WiX, I was curious to find out what are the best practices when using KeyPath
attribute on other elements including Component
, Directory
, Registry
etc, etc.
I am interested in any general suggestion, but here are a couple of concrete questions:
- If I have an empty directory that installer needs to create should I
set
KeyPath="yes"
onDirectory
or its parentComponent
? What if it is not empty? - If a File has
KeyPath="yes"
in a file-per-component scenario, is it necessary or good practice to set it on its parent Component? - I read somewhere that instead of setting
KeyPath
on a File, one should use a Registry key for each File and setKeyPath="yes"
on Registry element...Is that really true/necessary?
Thanks!
Edit #1 - Clarification re: Directory
I was aware of Directory not having KeyPath, but was not explicit/detailed in my question. Mainly, I was curious about the usage of KeyPath on a Component when an empty directory has to be created. I am seeing that KeyPath="yes" is in such case being set on the parent Component. But is that enough for the installer to detect/repair missing empty folder? Or should it be used along with registry entry? Example snippet:
<Directory Id="LOGS" Name="Logs">
<Component Id="LogsDir" Guid="*" KeyPath="yes">
<CreateFolder Directory="LOGS" />
</Component>
</Directory>