2
votes

I'm trying to share a property between several products, which is not set by default. Except for one product, where I want to set it to a value.

So in shared.wxi:

<Include>
    <Property Id="MYPROP" Secure="yes"></Property>
</Include>

And in product.wxs:

<Wix>
    <Product>
        <?include ..\shared\shared.wxi?>
        <SetProperty Id="MYPROP" Value="1" After="InstallInitialize"/>
    </Product>
</Wix>

But our build system complains about:

error LGHT0094 : Unresolved reference to symbol 'WixAction:InstallUISequence/InstallInitialize' in section 'Product:{583365A4-93C2-434A-BCD8-8A1035DF2AC7}'

I'm not even sure if After="InstallInitialize" (or Before=...) is the right place, I just want to set the property for this product right after the include but before anything else is considered. Also, I'm pretty much clueless about the whole WIX system, I'm just trying to fix something quickly while the knowledgable colleague is on vacation.

UPDATE - Now I tried this instead of SetProperty, but still get the same error:

  <CustomAction Id="CA_SETMYPROP" Property="MYPROP" Value="1" />
  <InstallUISequence>
    <Custom Action="CA_SETMYPROP" Before="InstallInitialize" />
  </InstallUISequence>

UPDATE 2 - Now I replaced InstallUISequence with InstallExecuteSequence and it does what I want. See Rob Mensching's answer for an explanation and an alternative solution.

  <CustomAction Id="CA_SETMYPROP" Property="MYPROP" Value="1" />
  <InstallExecuteSequence>
    <Custom Action="CA_SETMYPROP" Before="InstallInitialize" />
  </InstallExecuteSequence>
1
Can you quickly explain what you need to achieve? MSI tends to fight back when you try to make quick fixes.Stein Åsmul
@SteinÅsmul Yes, I was aware of those variables. I guess I could have transformed the shared properties into variables to solve my problem but that would have forced me to change many places where those properties are already used.Simpleton

1 Answers

7
votes

This issue threw me for a loop when I first encountered it (fairly recently). The error message is correct but could be much more helpful*.

The root issue is that InstallInitialize does not exist in the InstallUISequence. By default, SetProperty uses both for the Sequence attribute. That means the set property is scheduled before/after InstallInitialize action in both the InstallExecuteSequence and the InstallUISequence. Since InstallInitialize does not exist in InstallUISequence you'll get the error:

Unresolved reference to symbol 'WixAction:InstallUISequence/InstallInitialize'

The fix is to use Sequence='execute' to only schedule the setting of the property in the InstallExecuteSequence where InstallInitialize lives. Alternatively, you can pick a different action to schedule before/after.

Using SetProperty would go a lot like this:

<SetProperty Id="MYPROP" Value="1" After="InstallInitialize" Sequence="execute" />

* Improving the error message is on my radar.