Click here to Skip to main content
15,860,859 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am building this application that relies on SQL Server. I have created the setup project for the application itself, and creating a bootstrap setup to install sql server is missing. Now I need to figure out what the instance name is to pass that to my installer, so I can alter the appsettings.json file when installed so it point to the right sql server.

I also worry about when I get to the update scenario.. how do I manage the merge of existing appsettings with new potential changens when a user runs a installer for a newer version.

So... do I need a custom action in my basic installer? How do I pass a found instance name to it.. and if none...

I am not completely new to Wix, but far from the expert yet...

What I have tried:

My basic installer:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>
  <Product Id="127168FB-470F-4B06-9780-4478143A05A3" Name="TM Server" Language="1033" Version="!(bind.fileVersion.filC762F4BC2B54E0905E8593724C7DEBB1)" Manufacturer="Applicity Systems" UpgradeCode="a9867aec-7660-4fa6-8425-d3599a697861">
    <Package InstallerVersion="300" Compressed="yes" Platform="x64" InstallPrivileges="elevated" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of TM Server is already installed." />
    <MediaTemplate EmbedCab="yes" />

    <Feature Id="ProductFeature" Title="TMServerSetup" Level="1" ConfigurableDirectory="APPLICATIONROOTDIRECTORY" TypicalDefault="install" Absent="disallow">
      <ComponentGroupRef Id="TMServerPayload" />
    </Feature>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFiles64Folder">
        <Directory Id="CompanyFolder" Name="Applicity Systems">
          <Directory Id="APPLICATIONROOTDIRECTORY" Name="TM Server" />
        </Directory>
      </Directory>
    </Directory>
  </Fragment>

</Wix>


My bootstrap

HTML
<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">
  <bundle name="TMServer" version="1.0.0.0" manufacturer="Applicity Systems" upgradecode="3a843d59-e6bd-43a9-8965-cafc81047ef3" copyright="2020 - Applicity Systems" disablemodify="yes">
    

    <bootstrapperapplicationref id="WixStandardBootstrapperApplication.RtfLicense">
      <bal:wixstandardbootstrapperapplication licensefile="EULA.rtf" suppressoptionsui="yes">
    

    <chain>
      
      <packagegroupref id="SQLServerExpress">
      <packagegroupref id="InstallerPackages">
      
    
  

  <fragment>
    
    <property id="MsiLogging" value="voicewarmup!">

    <util:registrysearch id="SqlInstanceKeyFoundSearch" 
="" root="HKLM" key="SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL" value="$(var.InstanceName)" result="exists" variable="SqlInstanceKeyFound" win64="yes">

    <packagegroup id="SQLServerExpress">
      <exepackage compressed="no" 
="" displayname="Installing SQL Server Express 2019" permachine="yes" cache="yes" vital="yes" permanent="no" installcommand="/IACCEPTSQLSERVERLICENSETERMS /HIDECONSOLE /INSTANCEID="$(var.InstanceName)" /ACTION="Install" /FEATURES=SQLENGINE /HELP="False" /INDICATEPROGRESS="False" /QUIET="True" /QUIETSIMPLE="False" /ERRORREPORTING="False" /SQMREPORTING="False" /INSTANCENAME="$(var.InstanceName)" /AGTSVCSTARTUPTYPE="Manual" /ISSVCSTARTUPTYPE="Automatic" /ISSVCACCOUNT="NT AUTHORITY\NetworkService" /ASSVCSTARTUPTYPE="Automatic" /ASCOLLATION="Latin1_General_CI_AS" /ASDATADIR="Data" /ASLOGDIR="Log" /ASBACKUPDIR="Backup" /ASTEMPDIR="Temp" /ASCONFIGDIR="Config" /ASPROVIDERMSOLAP="1" /SQLSVCSTARTUPTYPE="Automatic" /FILESTREAMLEVEL="0" /ENABLERANU="True" /SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS" /SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /ADDCURRENTUSERASSQLADMIN="True" /TCPENABLED="0" /NPENABLED="0" /BROWSERSVCSTARTUPTYPE="Disabled" /RSSVCSTARTUPTYPE="Automatic" /RSINSTALLMODE="FilesOnlyMode"" uninstallcommand="/Action=Uninstall /INSTANCENAME="$(var.InstanceName)" /FEATURES=SQLENGINE /QUIET="True" /HIDECONSOLE" installcondition="NOT SqlInstanceKeyFound" downloadurl="https://download.microsoft.com/download/7/c/1/7c14e92e-bdcb-4f89-b7cf-93543e7112d1/SQLEXPR_x64_ENU.exe" name="SQLEXPR_x64_ENU.exe">
        <remotepayload certificatepublickey="5FCDD851BFFDA72C15B53C6F3B14E1E773E590BE" certificatethumbprint="E942D27A35DCBBE072872AD9E9E0AC4C948A7864" description="Microsoft SQL Server 2019  Express" hash="A0086387CD525BE62F4D64AF4654B2F4778BC98D" productname="Microsoft SQL Server 2019  Express" size="261082544" version="15.0.2000.5">
      

    

  

  <fragment>
    <property id="MsiLogging" value="voicewarmup!">
    <packagegroup id="InstallerPackages">
      <msipackage id="TMServer" displayname="TM Server" cache="yes" compressed="yes" sourcefile="$(var.TMServerSetup.TargetPath)" vital="yes" forcepermachine="yes">
Posted
Updated 17-Aug-20 2:34am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900