Reputation: 65
I have a program which is dependent upon postgres. The installer I made will install postgres for the user; however, I would like this to only happen if Postgres is not already installed. I'm attempting to do this through a custom action with conditions, however, I cannot seem to get it to work. Any help would be greatly appreciated. This is what I currently have.
<Property Id="POSTGRESINSTALLED">
<RegistrySearch Id="POSTGRESINSTALLED_SEARCH" Key="SOFTWARE\PostgreSQL\Installations\postgresql-x64-9.5" Root="HKLM" Type="raw" Name="Branding" />
</Property>
<InstallExecuteSequence>
<Custom Action='postgres_install_action' After='vc_redist_install_action'> ( NOT POSTGRESINSTALLED ) OR ( REINSTALL ) </Custom>
</InstallExecuteSequence>
Upvotes: 3
Views: 3178
Reputation: 20780
It's not clear which part is not working, the detection or the install.
If you run the install and produce a log (msiexec /I [path to msi] /l*vx [path to text log]) you'll see if POSTGRESINSTALLED_SEARCH is being set. The install doesn't need to complete because the search is early. Assuming you've got the general idea correct, you haven't explicitly said whether to search the 32-bit registry or the 64-bit registry. It may simply be looking in the wrong place.
If the search works, then the install can easily fail. The custom action appears to be immediate (the default) so it will not run elevated and is therefore likely to fail. The same is true of the vc redist install custom action.
The model for installing prerequisites is to use a bundle to install them first. These should help, but that's the way you should be doing this:
http://wixtoolset.org/documentation/manual/v3/bundle/
How to include prerequisites with msi/Setup.exe in WIX
WiX - Install Prerequisites and 3rd party applications
Upvotes: 1