Since I cannot put conditions on elements in a component, I have to separate the items into two separate components conditional. From every example, this is how to do it:
<Component Id="IIS7Webhost" Guid="482EC8D7-2DA2-48e6-A11D-6CAB3C5973E8">
<Condition><![CDATA[IIS_MAJOR_VERSION >= "#7"]]></Condition>
<CreateFolder>
<Permission User="IUSR" GenericAll="yes"/>
</CreateFolder>
</Component>
<Component Id="IIS6Webhost" Guid="51C65FAC-84B7-43d1-A230-DD9AE66B5D99">
<Condition><![CDATA[IIS_MAJOR_VERSION <= "#6"]]></Condition>
<CreateFolder>
<Permission User="IUSR_[ComputerName]" GenericAll="yes"/>
</CreateFolder>
</Component>
But BOTH of these components install on every system and fail because only one of those users exists. What am I doing wrong here?
IIS_MAJOR_VERSION
is set correctly to either #6
or #7
. Also I believe I have the syntax correct because the launch condition works correctly:
<Condition Message="Internet Information Services 5, 6, or 7 must be installed.">
<![CDATA[Installed OR (IIS_MAJOR_VERSION >= "#5" AND IIS_MAJOR_VERSION <= "#7")]]>
</Condition>
Edit: It appears both do NOT install, but Windows Installer checks the existence of each user (while ignoring the condition) before it goes about creating directories. Is there a way to skip this check? I already know one of those users will not exist.