0

Here's my situation.

I need to integrate the installation files of Erlang, RabbitMQ and my Msi package into one single Wix Bundle. I am currently using a Bootstrapper project to help me do it, and I'm still struggling with how to check the availability of Erlang and RabbitMQ inside my local machine. As far as I know, there're 3 options:

Do the RegistrySearch with the RememberProperty pattern: This one seems impossible since after uninstalling Erlang, the reg key is still there.

Use the CustomAction to run a check by cmd line. This one is not very likely too since Window Installer does not support return value from CustomAction.

Do the Directory and FileSearch. We cannot make the assumption about where users install the files on their local machine, so this one is also not likely.

What do I miss? Did I do wrong somewhere else? Can you guy help me with this? How can I validate the existence of RabbitMQ and Erlang by using Wix?

Below is my code:

Bundle.wxs

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <?define BundleName = "My Bundle name" ?>
  <?define BundleVersion = "1.0.0.0" ?>
  <?define BundleFullVersion = "1.0.0.0" ?>
  <?define BundleManufacturer = "My Company" ?>
  <?define BundleUpgradeCode = "My Upgrage code" ?>
  <Bundle Name="$(var.BundleName)"
          Version="$(var.BundleVersion)"
          Manufacturer="$(var.BundleManufacturer)"
          UpgradeCode="$(var.BundleUpgradeCode)">
    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense">
      <bal:WixStandardBootstrapperApplication
        SuppressOptionsUI="yes"
        LicenseUrl=""
        LogoFile=".\resources\images\my_logo.png"/>
    </BootstrapperApplicationRef>
    <Chain>
      <PackageGroupRef Id="ExePackages"/>
      <PackageGroupRef Id="MsiPackages"/>
    </Chain>
  </Bundle>
</Wix>

ExePackages.wxs

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Fragment>
    <util:RegistrySearch
      Root="HKLM"
      Key="SOFTWARE\Ericsson\Erlang\ErlSrv\1.1\RabbitMQ"
      Format="raw"
      Variable="RabbitMQRegistrySearch"
      Win64="yes"
      Result="exists"/>
    <util:RegistrySearch
      Root="HKLM"
      Key="SOFTWARE\Ericsson\Erlang\ErlSrv\1.1"
      Format="raw"
      Variable="ErlangRegistrySearch"
      Win64="yes"
      Result="exists"/>
    <PackageGroup Id="ExePackages">
      <ExePackage Id="Erlang"
                  DisplayName="Erlang"
                  Compressed="yes"
                  Permanent="yes"
                  Cache="yes"
                  PerMachine="yes"
                  Vital="yes"
                  DetectCondition="ErlangRegistrySearch"
                  SourceFile=".\Prerequisites\otp_win64_20.0.exe"/>
      <ExePackage Id="RabbitMQ"
                  DisplayName="RabbitMQ"
                  Compressed="yes"
                  Permanent="yes"
                  Cache="yes"
                  PerMachine="yes"
                  Vital="yes"
                  DetectCondition="RabbitMQRegistrySearch"
                  SourceFile=".\Prerequisites\rabbitmq-server-3.6.5.exe"/>
    </PackageGroup>
  </Fragment>
</Wix>

3 Answers3

0

You have 2 options for that.

  1. Use custom MBA - managed bootstrap application. Check this for starting point. Alot of effort ( C# WPF application)
  2. Use a bafunctions project in order to check if the service exist\registry\directory etc... (C++ just to add few methods). This project is part of wix source code.
Arkady Sitnitsky
  • 1,846
  • 11
  • 22
  • Thanks for your reply, can you make it more specific? I am trying to verify the installation of Erlang on my local machine, and I cannot find the solution anywhere on the internet. For your suggestion, I am confused about how can I use a command line, and use the result from it to make the program work like I want. A little more detail would be really appreciated. – Thang H. Vu Nov 22 '17 at 09:10
0

I do not know much how RabbitMQ installs itself on Windows and which registry keys it sets, but here is another side of the problem — it is possible to detect whether Erlang is currently running by checking for running EPMD or checking if it listens to its default port 4369.

Since EPMD registers all local running Erlang nodes it might also be possible to contact it via its binary TCP protocol and get a list of nodes to check whether RabbitMQ node is present, but that is extra coding which is too complicated for a simple task of software detection.

Another thing to try is to check 1-2 known program locations in C:/Program Files and ...(x86) and registry for installed software (not sure which keys, should consult the RabbitMQ installer source or something).

Other than these two things (EPMD running on port 4369 and known directory locations) I'm afraid you'll have to ask the user to provide you the answer.

  • For the second option, I can check RabbitMQ via Registry key, but not for Erlang (since it's still there even if we uninstalled the program). Thanks for your comment tho, I am looking for a simpler solution rather than do the first option you provided. – Thang H. Vu Nov 24 '17 at 07:18
0

the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Ericsson\Erlang\9.0 may help

try this:

<util:RegistrySearch
      Root="HKLM"
      Key="SOFTWARE\Wow6432Node\Ericsson\Erlang\9.0"
      Format="raw"
      Variable="ErlangRegistrySearch"
      Win64="yes"
      Result="exists"/>
Bob Dust
  • 2,370
  • 1
  • 17
  • 13