tags:

views:

522

answers:

3

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.

+1  A: 

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
Just to let you guys know... I'm on vacation for 2 days and will try this out tomorrow.
Eric J.
+3  A: 

The erorr 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"/>

Rob Mensching
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.
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
Hey, thanks, that makes sense, thanks, but what if the icon is not a standalone file, but is in my executable?
Tartley
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.
Tartley
+1  A: 

Rob is right here, add an icon element as shown above!