Rohit L
Rohit L

Reputation: 1561

WIX MSI - PROPERTY override precedence

Any help will be much appreciated.

I'm writing this WIX installer to get an MSI to install a web app on our servers.

Within my app, I have this PROPERTY - "WEBDIR". I use this property later in my code as a Directory Id.

I set this property in 3 ways.

  1. (Method 'A') As a property passed when you call msiexec in quiet mode. [Setting it here as C:\Path1] Like so:

    msiexec /quiet /i My.msi WEBDIR="C:\Path1" /l*v InstallationLog.log
    
  2. (Method 'B') From an IniFileSearch. I have an ini file in C:\Windows called MySetup.ini where the key WebsitesDir resolves the value C:\Path2. [Setting it here as C:\Path2]:

    <Property Id="WEBDIR">
        <IniFileSearch Id="WebsitesDirIni" Name="MySetup.ini" Section="InstallLocations" Key="WebsitesDir" Type="raw"/>
    </Property>
    
  3. (Method 'C') Using a default directory structure. [Setting it here as C:\Path3] As follows:

    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="WEBDIR" Name="Path3">
        </Directory>
    </Directory>
    

The way it currently works is as follows: - When Methods 'A', 'B' and 'C' all set the property value, B takes precedence. - When only Methods 'A' and 'C' set the property value, 'C' takes precedence.

What I want is to be able to set the order of precedence to 'A'. If !'A' then 'B' else 'C'.

Is this possible?

Upvotes: 4

Views: 2174

Answers (1)

Cosmin
Cosmin

Reputation: 21426

No, this is not possible. If you want to control the order the best approach would be an immediate custom action. Since it needs to set an installer property, your custom action must receive the installation handle (a win32 DLL is recommended).

Under normal circumstances the installer will use this order:

  1. A command line value initializes the property
  2. A directory row sets the initial folder path, overriding the command line value. This path can be later modified by costing actions (CostFinalize).
  3. A search overrides the initial folder path, but may be overridden by costing actions.

Upvotes: 1

Related Questions