Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to silent run an installer of another program(PostgreSQL) during the installation in WIX?

My company is developing an application that has a dependency on PostgreSQL, we are developping the installer by using WIX. How can we make the PostgreSQL installer (which is also a msi file) run automatically when installing our application? What do we need to set in Wix? If you happen to know any webpage explains this, please post the link. Thank you!

like image 795
Ray Avatar asked Dec 08 '25 10:12

Ray


1 Answers

Here's a bootstrapper I wrote to add MSXML 6 to one of our installers. The following website was crucial in helping me understand what needed to be done, and might be able to fill in any blanks that you might have: http://msdn.microsoft.com/en-us/library/aa730839%28VS.80%29.aspx

Specifically for your question about getting the installer to run silently, you will need to add the proper switches to the @Arguments attribute of the Command element, which will probably look something like:

<Command PackageFile="PostgreSQL.msi" Arugments="/quiet"/>

You will also need to find the ProductCode of the MSI you are using (using MS Orca) to make sure that the bootstrapper does not try to run the installation if PostgreSQL is already installed:

<InstallChecks>
  <MsiProductCheck 
      Property="IsPostgresInstalled" 
      Product="{PRODUCT-CODE-OF-POSTGRESQL-MSI}"/> 
</InstallChecks>

product.xml:

<Product
    xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
    ProductCode="Microsoft.MSXML.6.SP2">

  <PackageFiles>
    <PackageFile Name="msxml6-KB954459-enu-x86.exe"/>
  </PackageFiles>

  <InstallChecks>
    <MsiProductCheck 
        Property="IsMsiInstalled" 
        Product="{1A528690-6A2D-4BC5-B143-8C4AE8D19D96}"/>
  </InstallChecks>

  <Commands>
    <Command PackageFile="msxml6-KB954459-enu-x86.exe" Arguments="">
      <InstallConditions>
        <BypassIf 
            Property="IsMsiInstalled" 
            Compare="ValueGreaterThan" Value="0"/>
        <FailIf Property="AdminUser" 
                Compare="ValueNotEqualTo" Value="True"
                String="NotAnAdmin"/>
      </InstallConditions> 

      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <ExitCode Value="1641" Result="SuccessReboot"/>
        <ExitCode Value="3010" Result="SuccessReboot"/>
        <DefaultExitCode Result="Fail" String="GeneralFailure"/>
      </ExitCodes>
    </Command>
  </Commands>
</Product>

Here is the project that I run MSBuild with:

<Project ToolsVersion="3.5"
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <ItemGroup>
    <BootstrapperFile Include="Microsoft.MSXML.6.SP2" >
      <ProductName>Microsoft MSXML 6 SP2</ProductName>
    </BootstrapperFile>
  </ItemGroup>

  <Target Name="setup">
    <GenerateBootstrapper
        ApplicationFile="@PROJECT-EXE@"
        ApplicationName="@PROJECT@"
        BootstrapperItems="@(BootstrapperFile)"
        Path="C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper"
        ComponentsLocation="Relative"
        OutputPath="."
        Culture="de"/>
  </Target>

</Project>

I hope this helps.

like image 71
Zach Young Avatar answered Dec 11 '25 04:12

Zach Young



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!