9

I'm just starting out with WiX 3 and can't figure out why it can't understand the Icon attributes in my .wsx file. I get the error message:

Error 2 Unresolved reference to symbol 'Icon:Sample.exe' in section 'Product:{95DB18C7-24DC-474D-B58C-DC91AFD912F3}'.

The section it is complaining about is:

<Shortcut Id="startmenuSample" Directory="ProgramMenuFolder" Name="Sample 1.0"
 WorkingDirectory='INSTALLDIR' Icon="Sample.exe" IconIndex="0" Advertise="yes" />

If I comment that section out, the installer works fine.

Shay Erlichmen
  • 31,691
  • 7
  • 68
  • 87
Eric J.
  • 147,927
  • 63
  • 340
  • 553

2 Answers2

9

The error message is trying to tell you that the Shortcut/@Icon attribute is referencing an Icon element with Id attribute = "Sample.exe". However, the Icon element does not exist. There should have been a line number in there to help you find the reference.

Anyway, you need something like

<Icon Id="Sample.exe" SourceFile="your.ico"/>

Chris Schiffhauer
  • 17,102
  • 15
  • 79
  • 88
Rob Mensching
  • 33,834
  • 5
  • 90
  • 130
  • Hey Rob just realized your "the guy" for WiX. I'm having a harder-than-necessary time understanding WiX by pulling together various examples and asking questions. Is there a piece of solid documentation I'm missing? – Eric J. Aug 09 '09 at 18:07
  • Have you read the WiX.chm and WiX tutorial? Without an overview of the system it can very difficult to jump in the middle. – Rob Mensching Aug 12 '09 at 20:02
  • Hey, thanks, that makes sense, thanks, but what if the icon is not a standalone file, but is in my executable? – Jonathan Hartley Oct 02 '09 at 13:40
  • I have just realised that for a non-advertised shortcut (which is a normal shortcut, advertised ones redirect via the Windows Installer mechanism every time you click on them) you can omit the shortcut's Icon attribute, it seems to default to the icon of the target file. Hooray. – Jonathan Hartley Oct 02 '09 at 14:05
1

If you mark the shortcut as "Advertise=yes", then the icon is not available yet because your app is not yet installed, only advertised.

You have to include the icon directly in the msi, not in the advertised exe. Or set "Advertise=no".

Stefan
  • 43,293
  • 10
  • 75
  • 117