glenatron
glenatron

Reputation: 11372

Can I use a Wix Custom Action to determine whether to install bootstrap packages?

I'm relatively new to using Wix for bootstrapping - my app needs to install PostgreSQL and the PosgreSQL ODBC connector and Wix seems well equipped to do that but what I can't find is how to ensure I only run those installers if the applications aren't already present.

The registry keys for both seem to be very version dependent and the Default registry key doesn't seem to be set so I end up needing to check whether the registry folder exists to verify whether the tool exists in an updated state (which will be quite compatible with my application) but it seems as though Wix can only search for key values, not for the existence of folders.

This answer gives a pretty great explanation of how to do what I'm looking for using a Custom Action, other answers suggest custom properties can't be used to pass values to installers, but all I want to do is to use them as a switch. Is there a way to do this?

My (not currently working/tested at all) Bundle code looks like this:

  <Bundle Name="My_Tool_Bootstrapper" Version="1.0.0.0" Manufacturer="" UpgradeCode="9d165ae8-303f-4887-b045-100470ed3b04">
    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
    <Property Id="PostgresInstalled">0</Property>
    <Property Id="PGODBCInstalled">0</Property>
    <CustomAction Id="CheckPGInstalled" BinaryKey="VerifyPostgresInstallation.dll" DllEntry="VerifyPostgresInstalled" Execute="immediate" />
    <Chain>
      <PackageGroupRef Id="NetFx462Redist"/>
      <ExePackage Id="PostgreSQL-13.4" SourceFile="postgres-13.4-1-windows-x64.exe"/>
      <ExePackage Id="PGODBC-Connector" SourceFile="psqlodbc-setup.exe" />
    </Chain>
  </Bundle>

Wix rejects this configuration, and I can't find any guidance on where and how I should arrange it so that it can work, making me wonder whether this is even possible. If we assume the Custom Action does what it is supposed to, is there a way to use properties this way? Am I barking up completely the wrong tree in expecting Wix to be able to conditionally install packages without a very specific registry key?

Upvotes: 0

Views: 154

Answers (1)

Bob Arnson
Bob Arnson

Reputation: 21896

Bundles do not support custom actions. You can use a custom bootstrapper application or, if you're using WixStandardBootstrapperApplication, IBootstrapperBAFunction.

Upvotes: 1

Related Questions