How to conditionally install pre-requisites based on custom action data from MSI

  Kiến thức lập trình

I have a wix project with 2 MSI’s, a bootstrapper, and my CA library. I want to run the first MSI which prompts the user to install files that setup for the later MSI. Based on what the user selects in the first MSI I want to be able to, from the bootstrapper, read data somehow (from registry, files, property, variable, etc…), to conditionally install a sql dependency.

Bundle.wxs

<MsiPackage SourceFile="$(var.PrepMsi.TargetPath)" bal:DisplayInternalUICondition="WixBundleAction = 6" Id="PrepMsi"  Visible="yes" Cache="keep">
    <MsiProperty Name="UI_LEVEL" Value="[WixBundleUILevel]"/>
    <MsiProperty Name="MSIRESTARTMANAGERCONTROL" Value="Detect"/>
</MsiPackage>

<PackageGroupRef Id="SQL_2019_Expr"/>

<MsiPackage SourceFile="$(var.SecondMSI.TargetPath)" Id="SecondMSI" Visible="no" Cache="keep" >
<!--<MsiPackage SourceFile="$(var.SecondMSI.TargetPath)" Id="SecondMSI" bal:DisplayInternalUICondition="WixBundleAction = 6" Visible="yes" Cache="keep">-->
    <MsiProperty Name="UI_LEVEL" Value="[WixBundleUILevel]"/>
    <MsiProperty Name="MSIRESTARTMANAGERCONTROL" Value="Detect"/>
    <MsiProperty Name="ORIGINALSOURCEFOLDER" Value="[WixBundleOriginalSourceFolder]"/>
</MsiPackage>

SQLExpr.wxs

 <PackageGroup Id="SQL_2019_Expr">
 
  <ExePackage Id="Sql2K19exe" Cache="keep" PerMachine="yes" Permanent="yes" Vital="yes" Compressed="yes" Name="SQL2019-SSEI-Expr.exe"
             SourceFile="..ReqInstallersSQL2019-SSEI-Expr.exe"
            InstallArguments="/c /SkipInstallerRunCheck /QS /IACCEPTSQLSERVERLICENSETERMS /CONFIGURATIONFILE="C:Program FilesImagingPrepTempSQLConfig.ini" /InstallPath=C:Program FilesMicrosoft SQL Server /ADDCURRENTUSERASSQLADMIN">

      <ExitCode Value="1638" Behavior="success"/>

  </ExePackage>
  
 </PackageGroup>

This has to happen during the installation as there are different scenarios for when I would install SQL based on the users selection.

I have tried scheduling the util:RegistrySearch inside the SQLExpr.wxs but all the RegistrySearchs seem to happen in the Planning phase of the bootstrapper. I have tried passing MsiProperty‘s to the MSI but any Property inside the MSI is local so writing to a file or a registry key would be (in my head) the only way to transfer the data outside of the MSI. My issue is how to read that data, during installation, from the bootstrapper to create an InstallCondition.

The way you’re trying to solve the problem goes against the design of Burn and, thus, will not work. Instead, you want a custom BootstrapperApplication to get all the user input before planning which/what gets installed and then execute that.

Think of execution as a transaction created during planning. Decisions are not made while the transaction is running. It just goes forward or fails and rolls back.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT