title: How to conditionally set a file extension using Wix?
body: <p>I'd like to conditionally set a file extension during install.  As I understand it, in order to do anything conditionally in Wix, it should be a self-contained component.  So for each file type association I would like to allow the user to set, I've got a component similar to the following:</p>
  
  <pre><code>&lt;Component Id="FileAssocComponent_PS" Guid="DAFE9461-2DF0-934A-F204-6B28CEA23C01"&gt;
    &lt;Condition&gt;FILE_ASSOC_PS&lt;/Condition&gt;
    &lt;RegistryValue Root="HKLM" Key="SOFTWARE\PrinterApp\Capabilities\FileAssociations" Name=".prn" Value="PrinterApp.ps" Type="string" /&gt;
    &lt;RegistryValue Root="HKLM" Key="SOFTWARE\PrinterApp\Capabilities\MIMEAssociations" Name="application/postscript" Value="PrinterApp.ps" Type="string" /&gt;
    &lt;RegistryValue Root="HKLM" Key="SOFTWARE\Classes\PrinterApp.ps" Name="FriendlyTypeName" Value="PostScript File" Type="string" /&gt;
    &lt;ProgId Id="PrinterApp.ps" Description="PostScript File" Icon="PrinterApp.ico" Advertise="yes"&gt;
      &lt;Extension Id="ps"&gt;
        &lt;Verb Id="open" Command="Open" Argument="&amp;quot;%1&amp;quot;"/&gt;
      &lt;/Extension&gt;
    &lt;/ProgId&gt;
  &lt;/Component&gt;
  </code></pre>
  
  <p>But this gives me the following error:</p>
  
  <p><code>error LGHT0204: ICE19: Extension: 'ps' advertises component: 'FileAssocComponent_PS'. This component cannot be advertised because the KeyPath type disallows it.</code></p>
  
  <p>I've tried setting KeyPath="yes" on one of the registry entries, but that doesn't work - and from what I've been able to find it's expecting a file KeyPath.  But this is a component that doesn't contain any files!</p>
  
  <p>How do I get around this error, or am I going about this the wrong way?</p>