Daan
Daan

Reputation: 2858

How to disable the uninstall button in a wix bundle installer?

I have an application that can be installed with a Wix installer. I order to ensure the product is uninstalled exactly in the way it is specified by the requirements, I created a script for the uninstall process using powershell. Therefore, logically, I want to disable the uninstall button of my installer so it can not be uninstalled via that way after installation. How to disable this button? Here is my bundle.wxs

<?xml version="1.0" encoding="UTF-8"?>
<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">

    <?include ..\InstallPlugin\Forwards.wxi?>

    <Bundle
        Name="$(var.ProductTitle)"
        Version="$(var.ProductVersion)"
        Manufacturer="$(var.ProductCompany)"
        Copyright="$(var.ProductCopyright)"
        DisableModify="yes"
        DisableRemove="yes"
        IconSourceFile="../Images/Icon.ico"
        UpgradeCode="f8b6f347-2832-41c9-9d89-112144f62ed8"
        >

        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkSidebarLicense">
            <Payload Name="en-US\License.rtf" SourceFile="../Licenses/License.en-US.rtf"/>
            <Payload SourceFile="../Images/Logo.png"/>
            <bal:WixStandardBootstrapperApplication
                LicenseUrl="XXXXXXXXXX"
                LogoSideFile="../Images/dialog.bmp"
                ShowVersion="yes" />
        </BootstrapperApplicationRef>
        <util:FileSearchRef Id="CondaFileFound" />

        
        <Chain>
            <PackageGroupRef Id="PluginSystem" />
            <MsiPackage SourceFile="XXXXXXXX"
                        Compressed="yes"
                        DisplayInternalUI="no"
                        Vital="yes"
                        Visible="yes"
            >
                <!-- <MsiProperty Name="USERLANGUAGE" Value="[UserLanguage]"/> -->
                <MsiProperty Name="USERLANGUAGE" Value="en-US"/>
            </MsiPackage>
            <ExePackage Id="MiniConda"
                        SourceFile="XXXXXXXXX"
                        InstallCommand="XXXXXXXXX"
                        DetectCondition="CondaFileFound"
                >
                <ExitCode Value ="3010" Behavior="success" />
            </ExePackage>
        </Chain>
    </Bundle>

    <Fragment>  
     <util:FileSearch
       Id="CondaFileFound"
       Path="XXXXXXXXXXXXX"
       Variable="CondaFileFound"
       Result="exists" />
    </Fragment>
</Wix>

Hopefully, I can make this possible with a simple change to my bundle file. All I want is to disable a button.

Upvotes: 0

Views: 324

Answers (1)

Kirumata
Kirumata

Reputation: 195

  1. Add attribute ThemeFile="HyperlinkSidebarTheme.xml"to the element bal:WixStandardBootstrapperApplication

  2. Copy file HyperlinkSidebarTheme.xml from [Wix Install dir]\SDK\themesto your project dir.

  3. Open copied file an delete/comment string

    <Button Name="UninstallButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.ModifyUninstallButton)</Button>
    

Upvotes: 1

Related Questions