[wix-users] Property Value Updating?

Skildum, Mat Mathew.Skildum at Aspect.com
Wed Sep 28 05:26:55 PDT 2016


Property values are usually string values. So you could try CLIENT_SERVER_INSTALL = "1".  You do not need to check the value is all you care about is if the property is set or not.  If you null the property when doing a server install then you could just use the property and if it is set to any value the condition will pass.  Likewise if you want the action to run when the property is not set you place a NOT in front of the property for a negative check.

The only reason you need to check the value of a property is if you have multiple values the property could be set to, such as if you are checking the state of feature or component where you have various options such as installed, installing and absent.

Mat Skildum



-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Brian Enderle
Sent: Wednesday, September 28, 2016 7:19 AM
To: WiX Users <wix-users at lists.wixtoolset.org>
Subject: [wix-users] Property Value Updating?

I have a dialog in my MSI that allows a user to select "Server" or "Client"
installation.  "Server" installation is supposed to execute a custom action setting up some SQL tables.  A "Client" installation should simply skip the CustomAction.

I am having an issue where if the user switches between "Server" and "Client", finalizing on "Server" before proceeding to the next screen,  the install will perform a "Client" installation.

I know the property is updating properly as I can see the log messages about modifying CLIENT_SERVER_INSTALL. Anyone know why the CustomActions are not being executed when CLIENT_SERVER_INSTALL = 1?


Action 8:00:57: ClientServerDlg. Dialog created MSI (c) (78:FC) [08:00:59:145]: PROPERTY CHANGE: Modifying CLIENT_SERVER_INSTALL property. Its current value is '1'. Its new value:
'0'.
MSI (c) (78:FC) [08:01:03:927]: PROPERTY CHANGE: Modifying CLIENT_SERVER_INSTALL property. Its current value is '0'. Its new value:
'1'.
MSI (c) (78:FC) [08:01:36:151]: Note: 1: 2727 2:
Action 8:01:36: AcctInfoDlg. Dialog created




The dialog is nothing more than two radio buttons:

<Fragment>

    <UI>

      <Property Id="CLIENT_SERVER_INSTALL" Secure="yes" Value="1" />

      <Dialog Id="ClientServerDlg" Width="370" Height="270"
Title="[ProductName] Setup" NoMinimize="yes">

        <!-- Back button takes us to Install Directory dialog -->
        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56"
Height="17" Text="!(loc.WixUIBack)">
          <Publish Event="NewDialog" Value="InstallDirDlg">1</Publish>
        </Control>

        <!-- Next button takes us to the Account Info dialog -->
        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56"
Height="17" Default="yes" Text="!(loc.WixUINext)">
          <!-- If Client option is selected, remove the FoxPro service from installation -->
          <Publish Event="Remove"
Value="ServiceFeature">CLIENT_SERVER_INSTALL = 0</Publish>
        </Control>

        <!-- Cancel button takes us to the Cancel dialog -->
        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56"
Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
          <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
        </Control>

        <Control Id="Title" Type="Text" X="15" Y="6" Width="200"
Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title} Client or Server Installation" />
        <Control Id="Description" Type="Text" X="25" Y="23" Width="280"
Height="15" Transparent="yes" NoPrefix="yes" Text="Please select if this is a client or server installation" />
        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370"
Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370"
Height="0" />
        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370"
Height="0" />

        <!-- Choose Client or Server installation -->
        <Control Id="ClientServerRadioButtonGroup" Type="RadioButtonGroup"
X="30" Y="63" Width="200" Height="100" Property="CLIENT_SERVER_INSTALL"
Text="Select Client or Server installation">
          <RadioButtonGroup Property="CLIENT_SERVER_INSTALL">
            <RadioButton Value="1" X="0" Y="0" Width="200" Height="10"
Text="Server" />
            <RadioButton Value="0" X="0" Y="20" Width="200" Height="10"
Text="Client" />
          </RadioButtonGroup>
        </Control>

      </Dialog>
    </UI>
  </Fragment>



I am calling the custom action from Product.wxs like so:

    <!-- CusomtActions.dll -->
    <Binary Id="CustomAction.CA"
SourceFile="$(var.SolutionDir)CustomActions\bin\CustomActions.CA.dll" />


    <InstallExecuteSequence>
      <!-- Only execute on install (not repair or uninstall) and for SERVER install -->
      <Custom Action='ExecuteSQLParameters' Before='InstallFinalize'>NOT Installed AND NOT REMOVE AND CLIENT_SERVER_INSTALL = 1</Custom>
      <Custom Action='ExecuteSQL' After='ExecuteSQLParameters'>NOT Installed AND NOT REMOVE AND CLIENT_SERVER_INSTALL = 1</Custom>
    </InstallExecuteSequence>


And here are the CustomAction calls:

    <!-- Need to perform a CustomAction to execute SQL command script with parameters -->
    <!-- ExecuteSQLParameters adds the various values, needed by the CustomAction, to the call to ExecuteSQL -->
    <CustomAction Id="ExecuteSQLParameters"
                  Return="check"
                  Property="ExecuteSQL"

Value="Server=[SQLSERVER];Database=master;Username=[SQLUSER];Password=[SQLPASSWORD];Directory=[INSTALL_SCRIPTS_FOLDER];FoxProPath=[FOXPROPATH]"
/>

    <!-- Execute the CustomAction code-->
    <CustomAction Id="ExecuteSQL"
                  BinaryKey="CustomAction.CA"
                  DllEntry="ExecuteSQLCustomAction"
                  Execute="deferred"
                  Impersonate="no"
                  Return="check" />



Brian

If you can't explain it simply, you don't understand it well enough.  - Albert Einstein

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
This email (including any attachments) is proprietary to Aspect Software, Inc. and may contain information that is confidential. If you have received this message in error, please do not read, copy or forward this message. Please notify the sender immediately, delete it from your system and destroy any copies. You may not further disclose or distribute this email or its attachments.


More information about the wix-users mailing list