1

To make the long story short, this doesn't work:

<Icon Id="msiexec.ico" SourceFile="[SystemFolder]msiexec.exe"/>

(Error 4 The system cannot find the file '[SystemFolder]msiexec.exe')

And this doesn't work too:

<Icon Id="msiexec.ico" SourceFile="$(var.SystemFolder)msiexec.exe"/>

Error 3 Undefined preprocessor variable '$(var.SystemFolder)'.

ptkvsk
  • 2,096
  • 1
  • 25
  • 47

1 Answers1

2

The second sample in your question will work if you pass var.SystemFolder as a parameter to candle.exe.

The <Icon> element is mapped to the Icon MSI table. At build time it tries to find the path you specify in SourceFile attribute and stream it as binary data to the Data column of the Icon table. This means, the path should be known at build time. But this is not true in your first sample - SystemFolder is resolved at install time.

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
  • Then it means hardcoding the path I'm passing to candle.exe and won't be any better then just writingSourceFile="C:\Windows\System32\msiexec.exe" I'm gonna accept your answer, but shouldn't there be a way of getting the resolved property here? – ptkvsk Jun 21 '12 at 13:59
  • 2
    @lonelyass: The `Icon` element will resolve the file in the same way as a `File` element. So you can just extract the icon from msiexec and put it among the files which get included in the setup. – Wim Coenen Jun 21 '12 at 14:19
  • I agree, @WimCoenen, extracting the icon and placing it together with other files is a good idea. – Yan Sklyarenko Jun 22 '12 at 05:41