Dee
Dee

Reputation: 53

Wix - Custom Action Return Code - Handling

Please read carefully as I will explain what I'm trying to do. I have a wix installer that calls custom action to validate user input. I want to call next dialog if validation is successful and NOT move if validation is not successful

  1. I have a custom action
  2. The custom action validates username and password
  3. If validation is successful, the custom action sets a property ([CONNECTED] = 1) value to 1
  4. If validation fails, it sets property value to empty and then pops up a message box that says value incorrect
  5. The custom action (c#) is executed in my dialog in next button
  6. The custom action executes fine, and it pops up when there is a failure Here is the problem If there is failure, a popup is made and my wix installer jumps to the end dialog (FINISH) to only give me option to exit the installation. Or it will sometimes give me the next dialog even though it failed. Here is the code for executing my custom action. <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_Next]"> <Publish Event="DoAction" Value="MyCustomAction">1</Publish> <Publish Event="NewDialog" Value="CustomizeDlg">CONNECTED= "1"</Publish> </Control>

My question is why does it not remain in the current dialog if there is an error meaning it did not return a 1. It goes to the Finish dialog after I click ok.

Upvotes: 1

Views: 3569

Answers (1)

PhilDW
PhilDW

Reputation: 20780

The return values from custom actions are intended for use by Windows Installer, not you. Returning ActionResult.Failure tells Windows that your CA failed so badly that the installation needs to finish. If your CA works fine and is not fatal to the installation process then return a success result. Use property values to denote user results.

In my experience the more usual method to deal with that type of dialog is to use the normal sequence from one dialog to the next. The only difference is that you start the dialog with the Next button disabled and Enable it if your user verification succeeds.

Upvotes: 2

Related Questions