6

I'm creating an installer for an IIS website using the WiX toolset and I use this manual. I've came across the following syntax:

<iis:WebSite Id="DemoWebsiteWebsite" Description='Demo Website' Directory='INSTALLFOLDER' AutoStart='yes' StartOnInstall='yes'>
  <iis:WebAddress Id="AllUnassigned" Port="80" />
  <iis:WebApplication Id="DemoWebsiteApplication" Name="[DemoWebsiteWebsite][WEBSITE_ID]" WebAppPool="DemoWebsiteAppPool"></iis:WebApplication>
</iis:WebSite>

I'm confused by the [] syntax and the way website id is used here. I need to use some custom values entered by user for that. So I have the following questions:

  1. What does the [] syntax mean in WiX? How is it related to the $() syntax that is used to access the defined value?
  2. Is there any additional meaning for two [] following each other like here [DemoWebsiteWebsite][WEBSITE_ID]?
  3. Why the WebSite Id is used in [DemoWebsiteWebsite] expression? Is that just a coincidence or naming convention?
  4. What are the allowed values to be used inside []? Is there any kind of list for them?
  5. Where can I find additional info about this syntax and cases it is used for?
Andreas
  • 5,393
  • 9
  • 44
  • 53
Pavel K
  • 3,541
  • 2
  • 29
  • 44
  • Short answer: It doesn't mean anything to WiX. @PhilDW's [answer](http://stackoverflow.com/a/23939543/2226988) explains what they mean to Windows Installer. – Tom Blodget Jun 01 '14 at 03:23

1 Answers1

16

This is the way that Windows Installer properties are resolved to the actual values. If you entered a property called WEBSITE into an MSI dialog you'd get that resolved to the actual value by putting it in square brackets. That's why you see things like [TARGETDIR], [SourceDir] and so on. The syntax is used in most tools that generate MSI files because it's a Windows Installer thing.

This is the doc link, it's all hidden here:

Formatted Windows Installer

So 1 - they are properties in the MSI file, either standard Windows Installer properties or user-created ones:

Property Reference

and 2, they are just two properties concatenated. They are case-sensitive so don't be sloppy with the case. The other points should be clear after understanding that they are installer properties.

The $() values in WiX source are compile time - they resolve at build time to actual values. The [] values resolve at install time.

PhilDW
  • 20,260
  • 1
  • 18
  • 28
  • That looks like a much better explanation! Could you please extend it by answering all the items 1-5 with more details? – Pavel K May 29 '14 at 17:45
  • Now it really almost completelly clear except of one thing - 3 - why the WebSite Id is used in [DemoWebsiteWebsite] expression? Is that just a coincidence or somewhere there is a Property defined that corresponds WebsiteId? If yes, to what value does it evaluates? – Pavel K May 29 '14 at 17:57
  • 2
    By definition if there is a property in brackets like that then there must be something somewhere that creates that property, and a WiX build will error if it can't find a reference. The difficulty is that you can create properties just by specifying them, including on an msiexec command line, and there's no list of the default value for user-defined properties unless they are in the Property table of the MSI file, using the Property Id element in WiX. – PhilDW May 29 '14 at 18:06
  • Thanks for that answer! I'll try to use Orca software to determine, what is the value of that property then. If I'll not find it in Property table - I'll then just try to determine it in runtime – Pavel K May 29 '14 at 18:09
  • 1
    The !() syntax is useful to know about as well. Those are resolved at link time, and can be used to extract properties of linked files. See: http://wixtoolset.org/documentation/manual/v3/overview/light.html – Dave Andersen May 30 '14 at 17:51
  • @PhilDW The build will not fail because there is no attempt to resolve property references where formatted properties are used. After all, the property could be passed on the command-line. It need not otherwise have been created. – Tom Blodget Jun 01 '14 at 03:42