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)'.
The second sample in your question will work if you pass
var.SystemFolder
as a parameter tocandle.exe
.The
<Icon>
element is mapped to the Icon MSI table. At build time it tries to find the path you specify inSourceFile
attribute and stream it as binary data to theData
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.