Search code examples
variableswixcustom-action

WIX property from a Custom Action into a WIX variable


May seem like a trivial question but I cant get it to work.

QUESTION: Can u set a WIX property from a Custom Action into a WIX variable?

This is what I have tried:

<?define VAR = "ProductName"?>

<Product Id="*" Name="$(var.VAR)" Language="1033" Version="1.0.0.0" UpgradeCode="$(var.UpgradeCode)">

<Property Id="VAR">ProductName</Property>

<CustomAction Id='GetProductName' BinaryKey='GetProductName' DllEntry='GetProductName' Execute='immediate' Return='check' />
<CustomAction Id="CustomAction1" Return="check" Execute="immediate" Property="VAR" Value="[PRODUCTNAME]" />


<InstallUISequence>
  <Custom Action='GetProductName' After='AppSearch' />
  <Custom Action='CustomAction1' After='GetProductName' />
</InstallUISequence>

PRODUCTNAME is the property i have set from my custom action.

Thanks


Solution

  • WiX variables are a build / compile concept, not a installtime concept. It isn't possible.

    What are you really trying to do? If you are trying to change the ProductName property during the installation, be aware that you can't. That property is immutable once the installation starts.