Is there a way to pass data to a (managed, C#) CustomAction? Preferably using the CustomActionData collection of the Session object. I would also like to use the return value from my CustomAction within my UI Control section.
More specifically, I want to allow the user to specify a Username and Password under which a service I am installing will run. I have therefore created a dialog, when the user clicks Next I want to start a custom action that checks the credentials are valid. The custom action will return Success if the account exists and some other value if it doesn’t (preferably NotExecuted or SkipRemainingActions, but will settle for Failure).
Then in the (wxs) dialog if the custom action returns success just go to the next dialog (in the install sequence). If the action returns the alternate value (NotExecuted) a SpawnDialog will appear telling the user that the account cannot be verified but they can continue if they like, using a yes or no button.
If someone can explain the best way to do this in Wix that would be great.
Thanks.
Given the limitations of the windows installer UI, I decided to take a slightly different approach. I now enable/disable the Next button depending on whether the basic field input is valid, i.e. if the Username field is empty then the button is disabled. I use a (C#) CustomAction to validate that the user account exists, by passing the username/password via properties, and return the result in another property. Back within the installer UI, if the account is invalid a message box appears.
I also provide a check box that allows the user to ignore the account check and just proceed.
I got the idea from https://geekproject.com/post/wix-service-account-dialog/
See the image below.