Search code examples
pluginsinstallationwixfile-type

WiX plugin installer needs to reference primary installation


I have created a second plugin for my primary program which allows it to open additional file extensions. Now when creating the "Verb" element to associate the new file extension with the executable of the primary executable (installed from a different installer which I also created) I do not know how to reference said executable.

  <!-- Associate file type -->
  <ProgId Id='myfile' Description='My file'>
    <Extension Id='ext' ContentType='application/ext'>
      <Verb Id='open' Command='Open' TargetFile="INSERT MAGIC HERE" Argument='"%1"' />
    </Extension>
  </ProgId>

thanks brian


Solution

  • If you know the GUID of the Component that installed the file that is the target of the shortcut a ComponentSearch is the easiest way to get what you want. Something like:

    <Property Id="TARGET_FILE">
      <ComponentSearch Id="FindTargetFile" Guid="{GUID-OF-TARGET-FILE-COMPONENT}" Type="file">
         <FileSearch Id="FoundTargetFile" Name="file.exe" />
      </ComponentSearch>
    </Property>
    
    <Component>
    <ProgId Id='myfile' Description='My file'>
      <Extension Id='ext' ContentType='application/ext'>
        <Verb Id='open' Command='Open' TargetProperty="[TARGET_FILE]" Argument='"%1"' />
      </Extension>
    </ProgId>
    </Component>