[wix-users] How to show the result of a CA on a dialog?

Fyodor Koryazhkin fyodorkor at gmail.com
Wed Jan 8 06:11:07 PST 2020


Hi,
I would make different design:
1. In the dialog of feature selection on Next button add custom action that
checks what you need.
2. On the failure this action sets some property with the message you want
to show.
3. Next action in this next button is to show some small dialog that has
Text field associated with your property and OK button that closes this
dialog and reset the property.
4. The condition to show next dialog is if the property not set.
This way the customer can re-select features.
Example
<Publish Event="DoAction" Value="ValidateWindowsFeature" Order="1">FeatureA
= 3</Publish>
<Publish Event="SpawnDialog" Value="ErrorMessage"
Order="2">MESSAGEPROPERTYFROMACTION</Publish>
<Publish Event="NewDialog" Value="ErrorMessage" Order="3">NOT
MESSAGEPROPERTYFROMACTION</Publish>

Where Action  ValidateWindowsFeature sets  MESSAGEPROPERTYFROMACTION
property. And the ErrorMessage dialog looks like this:
<Dialog Id="ErrorMessage" X="50" Y="50" Width="270" Height="110"
Title="[ProductName] !(loc.ErrorMessageDlg_Title)">
  <Control Id="ErrorText" Type="Text" X="50" Y="15" Width="200" Height="50"
Text="[MESSAGEPROPERTYFROMACTION]" TabSkip="no" NoPrefix="yes" />
  <Control Id="O" Type="PushButton" X="102" Y="77" Width="66" Height="17"
Text="!(loc.WixUIOK)" TabSkip="yes" Default="yes">
    <Publish Property="MESSAGEPROPERTYFROMACTION" Value="{}">1</Publish>
    <Publish Event="EndDialog" Value="Return">1</Publish>
  </Control>
  <Control Id="ErrorIcon" Type="Icon" X="15" Y="15" Width="24" Height="24"
ToolTip="!!(loc.FatalErrorBitmap)" FixedSize="yes" IconSize="32"
Text="!(loc.ErrorDlgErrorIcon)" />
</Dialog>

During silent installation you call the same action that sets the mentioned
property. After that you put Customaction type 19 that has condition
MESSAGEPROPERTYFROMACTION. This action will terminate the installation.


On Wed, Jan 8, 2020 at 1:34 PM Peter Schraffl via wix-users <
wix-users at lists.wixtoolset.org> wrote:

> Thanks, but this doesn't seem to help.
> Maybe I understand something wrong, but such secure properties can be
> passed from the client (InstallUISequence) to the server side
> (InstallExecuteSequence) but not the other way round - which we would
> require?
> https://docs.microsoft.com/en-us/windows/win32/msi/securecustomproperties
>
> Maybe it is possible to schedule our CA in the InstallUISequence (somewhen
> after feature selection as it checks the features marked for installation).
>
> Kind regards
> PETER SCHRAFFL
>
> -----Original Message-----
> From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of
> Fyodor Koryazhkin via wix-users
> Sent: Dienstag, 7. Jänner 2020 15:08
> To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> Cc: Fyodor Koryazhkin <fyodorkor at gmail.com>
> Subject: Re: [wix-users] How to show the result of a CA on a dialog?
>
> Hi,
> Add SAMWINERRORMESSAGE to SecureCustomProperties property.
> <Property Id=" SAMWINERRORMESSAGE" Secure="yes" /> You set the property in
> Execute sequence but call the dialog in InstallUI sequence.
>
> On Tue, Jan 7, 2020 at 3:18 PM Peter Schraffl via wix-users <
> wix-users at lists.wixtoolset.org> wrote:
>
> > I have now retried it - without success, maybe someone can give me a
> hint:
> >
> > - I customized the FatalError dialog like so (added
> > [SAMWINERRORMESSAGE] to the "Text" attribute of the "Description"
> element):
> >         <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
> >            <Fragment>
> >               <UI>
> >                  <Dialog Id="SamwinFatalError" Width="370" Height="270"
> > Title="!(loc.FatalError_Title)">
> >                     ...
> >                     <Control Id="Description" Type="Text" X="135" Y="70"
> > Width="220" Height="80" Transparent="yes" NoPrefix="yes"
> > Text="!(loc.FatalErrorDescription1)   [SAMWINERRORMESSAGE]
> > !(loc.FatalErrorDescription2)" />
> >                  </Dialog>
> >
> >                  <InstallUISequence>
> >                     <Show Dialog="SamwinFatalError" OnExit="error"
> > Overridable="yes" />
> >                  </InstallUISequence>
> >
> >                  <AdminUISequence>
> >                     <Show Dialog="SamwinFatalError" OnExit="error"
> > Overridable="yes" />
> >                  </AdminUISequence>
> >
> >               </UI>
> >            </Fragment>
> >         </Wix>
> >
> > - replaced the reference to "FatalError" in the UI.wxs with
> > "SamwinFatalError"
> >         <DialogRef Id="SamwinFatalError" />
> >
> > - changed the custom action to set the property with
> >                session["SAMWINERRORMESSAGE"] = message.ToString();
> >
> > According to the msi log the property is set and the SamwinErrorDialog
> > is shown but the message itself is not - [SAMWINERRORMESSAGE] is
> > replaced with an empty string.
> >         ...
> >         MSI (s) (F4!80) [14:11:15:646]: PROPERTY CHANGE: Adding
> > SAMWINERRORMESSAGE property. Its value is 'Missing Windows Features!
> > What am I missing?...
> >         ...
> >         MSI (c) (40:34) [14:11:15:771]: Doing action: SamwinFatalError
> >         Action 14:11:15: SamwinFatalError.
> >         Action start 14:11:15: SamwinFatalError.
> >         Action 14:11:15: SamwinFatalError. Dialog created
> >
> > Kind regards
> > PETER SCHRAFFL
> >
> > -----Original Message-----
> > From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of
> > Peter Schraffl via wix-users
> > Sent: Dienstag, 7. Jänner 2020 11:53
> > To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> > Cc: Peter Schraffl <Schraffl at telecomsoftware.com>
> > Subject: Re: [wix-users] How to show the result of a CA on a dialog?
> >
> > Thanks for hints.
> >
> > Actually I have already tried the approach with the property and
> > modifying the FatalError dialog but maybe I did something wrong. Will
> > give it another try.
> >
> > Kind regards
> > PETER SCHRAFFL
> >
> > -----Original Message-----
> > From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of
> > Nir Bar via wix-users
> > Sent: Dienstag, 7. Jänner 2020 10:36
> > To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> > Cc: Nir Bar <nir.bar at panel-sw.com>
> > Subject: Re: [wix-users] How to show the result of a CA on a dialog?
> >
> > You can use my WiX extension to enable Windows Features:
> >
> > https://www.nuget.org/packages/PanelSwWixExtension/
> >
> > <Component>
> >
> > <panelsw:Dism EnableFeatures="IIS"/>
> >
> > </Component>
> >
> >
> >
> >
> >
> > As for the FatalError dialog, you can edit it to present a property,
> > say "MY_LONG_ERROR"
> >
> > Then in the CA set this property to the error message.
> >
> >
> >
> >
> >
> > --
> >
> > Nir Bar
> >
> > WiX Expert
> >
> >
> >
> >
> >
> >
> > ---- On Tue, 07 Jan 2020 10:48:44 +0200 Peter Schraffl via wix-users <
> > wix-users at lists.wixtoolset.org> wrote ----
> >
> >
> >
> > Hi all,
> >
> > our installer requires some features (basically IIS features) to be
> > installed and fails if those are not installed on the system. In such
> > cases the FatalError dialog is shown which does not provide any useful
> > information about the root cause of the issue.
> > That’s why we have implemented a C# custom action which does some checks.
> > If the checks fail, a message box with a dynamically generated text is
> > shown via the session.Message(…) function before the CA returns an
> > error result.
> > This is working fine so far.
> >
> > Anyways we would prefer to show the message on the FatalError dialog
> > (or less preferred on its own dialog). Mostly because the generated
> > message might be pretty long and the length of the text shown in the
> > message box is limited, causing the message to be cut off.
> >
> > So the general question is: how can the (dynamically generated) value
> > of a property (the “result” of a C# custom action) be shown on a dialog?
> > Preferably on the FatalError dialog.
> >
> > Any hints would be appreciated.
> > Thanks in advance and a happy new year.
> >
> > Kind regards
> > Schraffl Peter
> >
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant
> > http://www.firegiant.com/
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant
> > http://www.firegiant.com/
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant
> > http://www.firegiant.com/
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant
> > http://www.firegiant.com/
>
>
>
> --
> Regards,
> Fyodor Koryazhkin..
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/



-- 
Regards,
Fyodor Koryazhkin..



More information about the wix-users mailing list