Wix, setting a custom property to true does not work

Wix fragment: I am setting a property FEATURE_IS_SELECTED

<SetProperty Id="FEATURE_IS_SELECTED" Value="1" After="InstallFiles"  Sequence="execute"><![CDATA[&MyFeature=3]]></SetProperty>

then calling a Custom Action:

<Custom Action="ConfigureMyXml" Before="InstallFinalize">NOT Installed OR MaintenanceMode="Modify"</Custom>

Custom action:

 public const string IsFeatureSelected = "FEATURE_IS_SELECTED";

    public static ActionResult ConfigureMyXml(Session session)
        string value;
        MessageBox.Show("I will check if value is set");
        if (session.CustomActionData.TryGetValue(IsFeatureSelected, out value))
            //do sth here

        return ActionResult.Success;

When debugging this, the action is called, but the if condition is not true. Why the FEATURE_IS_SELECTED is not set ? and //do sth here does not execute?


Your configure custom action is not marked with an "execute" value, so the default value is immediate. That means CustomActionData isn't involved in getting the value. However, it looks like you want to alter an installed file, so the only change you need is to mark the CA as execute deferred so it runs after the files are actually installed, and then you will also need a separate custom action to prepare CustomActionData, as here:

How to pass CustomActionData to a CustomAction using WiX?

Your sequencing may be a little suspect - you can set FEATURE_IS_SELECTED anytime after CostFinalize and it can be immediate. Configuring your Xml might be better "after install files".

Need Your Help

Is there any ruby library for usb hid interfaces?

ruby rubygems jruby hid

I fear that there is no usb hid library, yet. Do anyone know good alternatives, which can be used together with ruby (e.g. jruby)?

Better UI messages when aborting saving in Django admin

django django-models django-admin

This question is connected to this one: Django - disable model editing