How can I set an icon for an asscociated file using WiX?

FROM: http://www.tramontana.co.hu/wix/lesson1.php#1.7

If your application handles its own file data type, you will need to register a file association for it. Put a ProgId inside your component. FileId should refer to the Id attribute of the File element describing the file meant to handle the files of this extension. Note the exclamation mark: it will return the short path of the file instead of the long one:

<ProgId Id='AcmeFoobar.xyzfile' Description='Acme Foobar data file'>
  <Extension Id='xyz' ContentType='application/xyz'>
    <Verb Id='open' Sequence='10' Command='Open' Target='[!FileId]' Argument='"%1"' />
  </Extension>
</ProgId>

To assign an icon to this file type, you have to specify the appropriate registry entries yourself inside your component:

<Registry Id='FooIcon1' Root='HKCR' Key='.xyz' Action='write'
  Type='string' Value='AcmeFoobar.xyzfile' />
<Registry Id='FooIcon2' Root='HKCR' Key='AcmeFoobar.xyzfile' Action='write'
  Type='string' Value='Acme Foobar data file' />
<Registry Id='FooIcon3' Root='HKCR' Key='AcmeFoobar.xyzfile\DefaultIcon' Action='write'
  Type='string' Value='[INSTALLDIR]Foobar.exe,1' />

This is how I did it. I declared:

<Icon Id="Icon.exe" SourceFile="..\Installer\Graph.ico" />

before </Product> and added it as a reference as follows:

<ProgId Id='myApp.exe' Description='Some description' Advertise='yes' Icon='Icon.exe'>
          <Extension Id='xyz' ContentType='application/text'>
            <Verb Id='open' Sequence='10' Command='Open' Argument='"%1"' />
          </Extension>
</ProgId>

Tags:

Wix