WIX optional checkbox on ExitDialog.wxs not working

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

WIX optional checkbox on ExitDialog.wxs not working

paulharley421
This post has NOT been accepted by the mailing list yet.
I'm trying to have a checkbox where I ask the user to create Desktop shortcut but it's not working.

Here is the code

<Product Id="{GUID goes here}" Name="WindowsFormsApp1" Language="1033"
    Version="1.0.0.0" Manufacturer="Lorem" UpgradeCode="{GUID goes here}">

    ... other codes

    <Feature Id="ProductFeature" Title="WindowsFormsApp1" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
        <ComponentRef Id="ApplicationShortcutDesktop" />
    </Feature>

    <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Create desktop shortcut?"/>
    <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Secure="yes" />
</Product>

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLFOLDER" Name="WindowsFormsApp1" />
        </Directory>
        <Directory Id="DesktopFolder" Name="Desktop">
            <Component Id="ApplicationShortcutDesktop" Guid="{GUID goes here}>
                <Condition>WIXUI_EXITDIALOGOPTIONALCHECKBOX</Condition>
                <Shortcut Id="ApplicationDesktopShortcut" Name="WindowsFormsApp1"
                    Target="[INSTALLFOLDER]WindowsFormsApp1.exe"
                    WorkingDirectory="INSTALLFOLDER"/>
                <RegistryValue Root="HKCU" Key="Software\Microsoft\WindowsFormsApp1"
                    Name="installed" Type="integer" Value="1" KeyPath="yes"/>
            </Component>
        </Directory>
    </Directory>
</Fragment>

When I set the value of property WIXUI_EXITDIALOGOPTIONALCHECKBOX to Value="1" it create the shortcut before I click finish. So I think the value was evaluated when the ExitDialog was loaded. So how can I fix it?

I also tried <Condition>WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1</Condition> but still no luck, I think After I click finish the program doesn't do anything, when I change the location of checkbox to InstallDirDlg, it was working.