WIX installer toolset - SQL Server and IIS express installation [closed]

巧了我就是萌 提交于 2020-07-04 04:25:22

问题


I have WIX installer with some custom UI screens out of which I have one custom UI screen with two radio buttons on it.i just want to install SQL Server Express and IIS Express depending radio button selection.How can i implement this functionality. I am using WIX 3.11.2 and Visual Studio 2019 in my project. Can anyone provide the reference links or code snippet which will help me to proceed further as i am totally new to WIX installer?


回答1:


You can try that by using InstallCondition

your bundle.wxs will have something like this

   <?xml version="1.0" encoding="UTF-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
    xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
      <Bundle Name="YourProductName" Version="1.0.0.0" Manufacturer="" UpgradeCode="aa89733d-62f6-44e9-80c7-04a69cb7c077">
        <Variable Name="InstallIISEXPRESS" Value="0" bal:Overridable="yes" Type="string" />
        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
        <Chain>
          <!-- TODO: Define the list of chained packages. -->
          <!-- <MsiPackage SourceFile="path\to\your.msi" /> -->
          <PackageGroupRef Id ='DatabaseGrp'/>
        </Chain>
      </Bundle>
      <Fragment>
        <PackageGroup Id ='DatabaseGrp'>
          <MsiPackage Id="SQLServerExpress_x86_msi"
                      Cache="yes"
                      InstallCondition= "NOT(InstallIISEXPRESS = 1)"
                      Visible ="yes"
                      Permanent="yes"
                      SourceFile="Path\To\Your\SQLServerExpressMSI">
            <MsiProperty Name="IACCEPTQLServerExpressLICENSETERMS"
                         Value="YES"/>
          </MsiPackage>

          <MsiPackage Id="IISExpress_x86_msi"
                      Cache="yes"
                      Visible ="yes"
                      InstallCondition= "InstallIISEXPRESS = 1"
                      Permanent="yes"
                      SourceFile="Path\To\Your\IISExpressMSI">
            <MsiProperty Name="IACCEPTIISExpressLICENSETERMS"
                         Value="YES"/>
          </MsiPackage>
        </PackageGroup>
      </Fragment>
    </Wix>

You need to add a reference to the BalExtension in your Bundle Project

You need to set the value of the variable InstallIISExpress from your Bootstrapper(Custom UI) project, which will decide which database MSI will get install. You can set that value from Bootstrapper project like this

Bootstrapper.Engine.StringVariables["InstallIISExpress"] = "0";
// If you want to install SQLEXPRESSSERVER then set it to "0"
// If you want to install IISEXPRESS then set it to "1"
// You can decide this value from radio button selected by user

InstallCondition indicates whether the package should be installed or not. If the condition evaluates to true, then the package may be installed. If the condition evaluates to false, then the package should not be installed. If the package is present and the condition evaluates to false the package will be uninstalled.



来源:https://stackoverflow.com/questions/61444128/wix-installer-toolset-sql-server-and-iis-express-installation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!