1

I'm trying to add an optional "Create Desktop Shortcut" checkmark box to the user interface of my bundle.wxs file. This file is part of my Wix v4 bundle project in Visual Studio 2022. How can I get this checkmark box added? This is my XML so far:

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
  <Bundle Name="My Application" Manufacturer="Company Name" Version="1.0.0.0" UpgradeCode="[INSERT-GUID-HERE]" IconSourceFile="logo_installed.ico">
    <BootstrapperApplication>
      <bal:WixStandardBootstrapperApplication 
          Theme="rtfLargeLicense"
          LogoFile="logo_installer.ico" 
          LicenseFile="LicenseAgreement_en.rtf"
          LaunchTarget="C:\Program Files\My Application\myapplication.exe"/>
    </BootstrapperApplication>
      
      <Chain>
          <PackageGroupRef Id="NetFx64" />
          <MsiPackage SourceFile="myapplication.msi" DisplayName="My Application"/>
      </Chain>

  </Bundle>
    <Fragment>
        <PackageGroup Id="NetFx64">
            <ExePackage
              Id="NetFx64"
              DisplayName="Microsoft .NET Desktop Runtime 6.0.16 (64-bit)"
              Compressed="yes"
              PerMachine="yes"
              Permanent="yes"
              Vital="yes"
              SourceFile="windowsdesktop-runtime-6.0.16-win-x64.exe"
              InstallArguments="/q /norestart"
              DetectCondition="Netfx64FullVersion >= v6.0.16.0">
                <ExitCode Behavior="success" />
            </ExePackage>
        </PackageGroup>
    </Fragment>

</Wix>

I have searched for child elements in WixStandardBootstrapperApplication in hopes of finding an element like I did for LaunchTarget, but none of the elements point to what I am looking for. I have also checked this website for related documentation, but have not found any:

https://wixtoolset.org/docs/intro/

Thank you!

paleonix
  • 2,293
  • 1
  • 13
  • 29
Stephen
  • 11
  • 3

1 Answers1

2

I faced the same problem and yes the existing documentation (currently) isn't very helpful. Here's what I did to add a custom checkbox to the theme/dialog:

Begin with a standard theme and modify or extend it (copy it to your project). Find them here: https://github.com/wixtoolset/wix/tree/develop/src/ext/Bal/wixstdba/Resources

I used the HyperlinkTheme.xml theme. Don't forget to also copy the localization file, in this case HyperlinkTheme.wxl.

Include the theme in your WixStandardBootstrapperApplication:

        <BootstrapperApplication>
            <bal:WixStandardBootstrapperApplication 
                LicenseUrl="https://www.example.com/license"
                Theme="hyperlinkLicense"
                ThemeFile=".\HyperlinkTheme.xml"
                LocalizationFile=".\HyperlinkTheme.wxl" />
        </BootstrapperApplication>

Then add a checkbox in the theme file (for example, HyperlinkTheme.xml):

        <Page Name="Options">
            <Label X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.OptionsHeader)</Label>
            <Label X="11" Y="121" Width="-11" Height="17" FontId="3" DisablePrefix="yes">#(loc.OptionsLocationLabel)</Label>
            <Editbox Name="InstallFolder" X="11" Y="143" Width="-91" Height="21" TabStop="yes" FontId="3" FileSystemAutoComplete="yes" />
            <Button Name="BrowseButton" X="-11" Y="142" Width="75" Height="23" TabStop="yes" FontId="3">
                <Text>#(loc.OptionsBrowseButton)</Text>
                <BrowseDirectoryAction VariableName="InstallFolder" />
            </Button>

            <!-- Added CheckBox Here -->
            <Checkbox Name="InstallPgAdminCheckbox" 
                      X="11" Y="150" Width="260" Height="17" 
                      TabStop="yes"
                      FontId="3">
                #(loc.InstallPgAdminCheckbox)
            </Checkbox>
            
            <Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
                <Text>#(loc.OptionsOkButton)</Text>
                <ChangePageAction Page="Install" />
            </Button>
            <Button Name="OptionsCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
                <Text>#(loc.OptionsCancelButton)</Text>
                <ChangePageAction Page="Install" Cancel="yes" />
            </Button>
        </Page>

Finally, include the checkbox as InstallCondition for your Package:

            <!-- Install pgAdmin -->
            <ExePackage 
                Id="pgAdmin4Package"
                SourceFile=".\Data\dotNetSetup.exe"
                Vital="no"
                UninstallArguments="yes"
                DetectCondition="false"
                InstallCondition="InstallPgAdminCheckbox" />

I hope this helps :)!

Lucas
  • 373
  • 1
  • 9
  • I added the RtfTheme.xml template and RtfTheme.wxl localization file to my project as you suggested and modified the RtfTheme.xml as you instructed. I then followed up by adding InstallCondition="InstallpgAdminCheckbox" to my NetFx64 ExePackage. Finally, I tested the installation file and did not see the checkmark box. Based off of the information I provided, are you able to see if I missed any steps? Thanks! – Stephen Apr 26 '23 at 15:31
  • Sounds good to me. If you see the dialog and only the checkbox is missing, then first make sure the coordinates are actually in the visible area. Also make sure you have set HideWhenDisabled="no" when you are using a EnableCondition on the checkbox. – Lucas Apr 26 '23 at 21:13