Conditionally set one WiX property for different values

I have an installer that deploys a website as an SSL or non-SSL IIS site depending on whether the property is set or not. I was asked to add a parameter to set the port, which is not a problem, but I would like to set the default value for the port (80 or 443) if the value is not set.

I tried something like:

<SetProperty Id="OUTPORT" Before="InstallFiles" Value="80"><![CDATA[SSL=0]]></SetProperty> <SetProperty Id="OUTPORT" Before="InstallFiles" Value="443"><![CDATA[SSL=1]]></SetProperty> 

But, obviously, WiX complains about a user action with a duplicate SetOUTPORT identifier.

Am I jumping from another WiX-shaped rabbit hole?

+6
source share
2 answers

SetProperty now supports the Action attribute so that you can specify custom action identifiers if you want to have multiple SetProperty elements for the same property with different conditions.

+6
source

The accepted answer is incorrect when you want to convert it into a complete sequence of user actions and sequences (no more?).

According to the documentation for WiX 3, SetProperty Element

Without installing SetProperty \ @Action

 <SetProperty Id="OUTPORT" Before="InstallFiles" Value="80"><![CDATA[SSL=0]]></SetProperty> <SetProperty Id="OUTPORT" Before="InstallFiles" Value="443"><![CDATA[SSL=1]]></SetProperty> Duplicate symbol 'CustomAction:SetInstallFiles' found 

Action . Line. By default, the action is "Set" + the value of the Id attribute. This optional attribute can override the name of the action in the case when several SetProperty elements are aimed at the same identifier (possibly with mutually exclusive conditions).

The following actions are not modified to record user actions.

 <SetProperty Action="SetInstallFiles0" Id="OUTPORT" Before="InstallFiles" Value="80"><![CDATA[SSL=0]]></SetProperty> <SetProperty Action="SetInstallFiles1" Id="OUTPORT" Before="InstallFiles" Value="443"><![CDATA[SSL=1]]></SetProperty> 

It works on WiX 3.7, and I'm not sure which first version it is available in.

+13
source

Source: https://habr.com/ru/post/892341/


All Articles