Announcement

Collapse
No announcement yet.

Cannot use variable for Icon (path to local .ico) in Control Panel or Shortcut window

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot use variable for Icon (path to local .ico) in Control Panel or Shortcut window

    Following happens with a very simple installation:

    Create a project with a single .exe file.

    Create a variable called MyAppIcon that has value: ..\..\Commun\TCG-AIR\AIRC.ico
    Variable name and value do not seem to matter anyway.

    Create a shortcut and use $(var.MyAppIcon) as custom icon
    and/or:
    Use $(var.MyAppIcon) as Icon for the Control Panel

    In this context, I run the build and get in the log window:
    ...
    setup.wxs
    ...\setup.wxs(55) : error CNDL0014 : The Shortcut/@Icon attribute's value, 'i_0001.MyAppIcon)', is not a legal identifier. Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.). Every identifier must begin with either a letter or an underscore.
    ...\setup.wxs(59) : error CNDL0014 : The Icon/@Id attribute's value, 'i_0001.MyAppIcon)', is not a legal identifier. Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.). Every identifier must begin with either a letter or an underscore.
    Error 4001: candle.exe returned 14

    Seems that the variable name is badly manipulated : 'i_0001.MyAppIcon)' instead of 'MyAppIcon'

    Everything seems Ok (to me) in project file.
    I join project file and log file for analysis (took me some time to understand I need to ZIP the attachment to allow upload).

    Just found a partial workaround:
    use a variable called MyAppIconDir that has value: ..\..\Commun\TCG-AIR
    and specify the file name where needed: $(var.MyAppIconDir)\AIRC.ico

    Philippe
    Attached Files

  • #2
    Indeed, what you are trying here does not work because the way and order the build constants are expanded and the project is compiled. However, you can do this differently. You can specify the path to the icon you wish to use with a relative path - relative meaning "in relation to the place where the project file is found". In my sample, I have placed the icon into a sub folder.

    Change this:
    Click image for larger version

Name:	SCRN-2017-04-10-05.png
Views:	109
Size:	3.8 KB
ID:	297765
    to this:
    Click image for larger version

Name:	SCRN-2017-04-10-06.png
Views:	74
Size:	4.2 KB
ID:	297766

    Now, no matter where the source files can be found, the project will compile properly.

    Ulrich

    Comment

    Working...
    X
    😀
    🥰
    🤢
    😎
    😡
    👍
    👎