Search code examples
sqldatabaseinstallationwixwixsharp

How can I use WixUI to select a server to run a script on Installation


Im using Wix# to deploy our software which needs to run an SQL script to install the database on installation.

However I would like to give the user the option to select the server to install the database on, or install a new server instance to run the script on.

I have looked into creating custom UI for the installer, as well as running SQL scripts and chaining other installations with the setup, but so far I couldn't figure out how to make the UI communicate with the setup.

Thanks in advance!


Solution

  • All data you're working with you can store in properties. Here's stackoverflow question about setting properties and binding them to controls. So if you want user to type name of database - just do it as described.

    But if you wat to show combobox with server list - it will be little bit harder. You should add combo box element, for example:

    <Control Type="ComboBox" Id="id" Width="10" Height="10" X="10" Y="10" Property="SELECTED_SERVER">
    

    And after that you'll have two options:

    1. Here's an option to manually populate it
    2. Here's an option to populate it dynamically. In this case you should run that custom action before you show combo box - for example on next click of previous window or after installer was just started.

    Anyway, your property (SELECTED_SERVER) will be binded to that control and you can easily use it in your script or custom action later.