We're currently in the process of upgrading our build scripts from 3.0 to 3.5, and fixing a bunch of old ICE errors along the way. I've read through a number of articles, but I'm slightly confused as to what is usually the best approach to using companion files.
Now, assuming File A.manifest is a companion file to A.exe...
Originally: our old build breaks up the 2 files in 2 components:
<Component Guid="*" Id="A.exe" SharedDllRefCount="yes">
<File Id="..." KeyPath="yes" Source="A.exe"/>
</Component>
<Component Guid="*" Id="A.exe.manifest" SharedDllRefCount="yes">
<File CompanionFile="A.exe" Id="..." Source="A.exe.manifest"/>
</Component>
Which triggers ICE54: WARNING Component 'A.exe.manifest' uses file 'A.exe.manifest' as its KeyPath, but the file's version is provided by the file 'A.exe', so I guess it's obviously wrong.
1st approach: So I tried adding KeyPath=yes to the companion's directory:
<Component .../>
<Component Guid="*" Id="A.exe.manifest" SharedDllRefCount="yes" KeyPath="yes">
<File CompanionFile="A.exe" Id="..." Source="A.exe.manifest"/>
</Component>
This suppresses the warning, but in Orca the KeyPath column of the component shows as blank, so I have doubts it's correct?
2nd approach: Next I tried combining the components:
<Component Guid="*" Id="A.exe" SharedDllRefCount="yes"> <!-- GUID is wrong! -->
<File Id="..." KeyPath="yes" Source="A.exe"/>
<File CompanionFile="A.exe" Id="..." Source="A.exe.manifest"/>
</Component>
But it seems that allowing WiX to automatically generate the GUIDs here wouldn't work. But if I have the GUIDs manually generated, each time we build it would break component rules when upgrading! We actually deploy a lot of companion files, so generating a hash of each component and permanently storing it might be unfeasible too. Ditto for using a dummy registry key for each companioned file.
TLDR: Which of the 2 approaches is actually the better practice in WiX?