title: Correct way to implement Wix companion files?
body: <p>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.</p>
  
  <p>Now, assuming File A.manifest is a companion file to A.exe...</p>
  
  <p><strong>Originally:</strong> our old build breaks up the 2 files in 2 components:</p>
  
  <pre><code>&lt;Component Guid="*" Id="A.exe" SharedDllRefCount="yes"&gt;
      &lt;File Id="..." KeyPath="yes" Source="A.exe"/&gt;
  &lt;/Component&gt;
  &lt;Component Guid="*" Id="A.exe.manifest" SharedDllRefCount="yes"&gt;
      &lt;File CompanionFile="A.exe" Id="..." Source="A.exe.manifest"/&gt;
  &lt;/Component&gt;
  </code></pre>
  
  <p>Which triggers <em>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'</em>, so I guess it's obviously wrong.</p>
  
  <p><strong>1st approach:</strong> So I tried adding <em>KeyPath=yes</em> to the companion's directory:</p>
  
  <pre><code>&lt;Component .../&gt;
  &lt;Component Guid="*" Id="A.exe.manifest" SharedDllRefCount="yes" KeyPath="yes"&gt;
      &lt;File CompanionFile="A.exe" Id="..." Source="A.exe.manifest"/&gt;
  &lt;/Component&gt;
  </code></pre>
  
  <p>This suppresses the warning, but in Orca the KeyPath column of the component shows as blank, so I have doubts it's correct?</p>
  
  <p><strong>2nd approach:</strong> Next I tried combining the components:</p>
  
  <pre><code>&lt;Component Guid="*" Id="A.exe" SharedDllRefCount="yes"&gt; &lt;!-- GUID is wrong! --&gt;
      &lt;File Id="..." KeyPath="yes" Source="A.exe"/&gt;
      &lt;File CompanionFile="A.exe" Id="..." Source="A.exe.manifest"/&gt;
  &lt;/Component&gt;
  </code></pre>
  
  <p>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 <em>a lot</em> 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.</p>
  
  <p><strong>TLDR: Which of the 2 approaches is actually the better practice in WiX?</strong></p>