1

This is my very first wix project. I downloaded wix 3.6 rc. My installation project includes 2 wcf and 1 silverlight projects. Everything works fine with default Wix UI. But now that I need to add sql database to it. It works fine with default values like below:

                  <Component Id='SqlComponent' Guid='8B72C159-1477-4A58-AFAE-E94D756BFFA6'>
                    <CreateFolder/>
                    <sql:SqlDatabase Id='SqlDatabase' Database='master' Server='.'
                      CreateOnInstall='yes' DropOnUninstall='no' ContinueOnError='yes'>
                      <sql:SqlScript Id='CreateTable' BinaryKey='CreateTable' ExecuteOnInstall='yes' />
                      <sql:SqlScript Id='CreateTable1' BinaryKey='CreateTable1' ExecuteOnInstall='yes' />
                    </sql:SqlDatabase>
                  </Component>

But I need to present a user interface for sql database path, database name, user name and password, if user and password is not specified then use windows user.

Just to see how to add a custom ui I tried the following: but it displays the custom ui right away. But I want it to show specifically for sql database installation only.

<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
  <Text>Ready to Install</Text>
</Control>

<Control Id="Install" Type="PushButton" X="304" Y="243" Width="56" Height="17"
    Default="yes" Text="Install">
  <Publish Event="EndDialog" Value="Return" />
</Control>

I guess, once I get it to show the custom UI exactly where I want, my next requirement is going to be able to get user input for database path, name, user and password and pass that information to the script. I'm not sure how to do that either.

coder
  • 4,121
  • 14
  • 53
  • 88

2 Answers2

3

Read up on the WiX UI extension in the .chm. Choose the dialog set that is most appropriate for your installer. Then you can customize it accordingly. Let's assume you want to customize the WixUI_Advanced dialog set:

  • Download the WiX source code
  • Navigate to the source code for the UI extension located in src\ext\UIExtension\wixlib.
  • Copy and rename the file *WixUI_Advanced.wxs* to something different such as *WixUI_Advanced_Custom.wxs*.
  • Open the .wxs file and be sure to rename the UI Id to <UI Id="WixUI_Advanced_Custom">.
  • Add *WixUI_Advanced_Custom.wxs* to your setup project.

Now you can reference your custom dialog set just like you would reference the other dialog sets in the UI extension. But the UI is not quite customized, it just provides the same functionality as the WixUI_Advanced dialog set. To add a new dialog, you need to create a new .wxs using the wix source as an example. Look at any of the dialogs in src\ext\UIExtension\wixlib for help. Then reference your dialog in *WixUI_Advanced_Custom.wxs* by adding and modifying the <Publish> elements to determine when your dialog is shown.

Wim Coenen
  • 66,094
  • 13
  • 157
  • 251
BryanJ
  • 8,485
  • 1
  • 42
  • 61
  • Hi! I'm having the same problem, and found your solution in many tutorial. I just can't make it work. I download the source code, I find the file to use, make a copy of it, add it to folder I'm working in, and than try using command line tools to make the .msi file. I use light.exe with -ext WixUIExtension and it gives me LGHT0091 errors. What am I doing wrong? – Andras Balázs Lajtha Sep 24 '12 at 09:08
  • Thanks for helping. I got many errors like below: LGHT0091: Duplicate symbol 'ControlEvent:WelcomeDlg/Next/NewDialog/VerifyReadyDlg/Installed AND PATCH' found. This typically means that an Id is duplicated. Check to make sure all your identifiers of a given type (File, Component, Feature) are unique. – Andras Balázs Lajtha Sep 24 '12 at 16:11
  • If you just copied the file, you need to change the Id. Typically you take an the file that drives an entire WiXUI dialog set and rename only that file (including the Id). Then if you need to add a file, you can copy and rename an existing file as an example (remember to rename the id). You don't have to go and rename every file in the set because your main .wxs file (that you renamed) will reference all the standard dialogs. I hope I explained that OK. – BryanJ Sep 28 '12 at 04:04
  • Thanks, that's what I thought too. What I did was take the element and change the id: . But this did not help, at this point I received all the errors complaining about referenced components having redundant Id-s although I did not copy those items. – Andras Balázs Lajtha Sep 30 '12 at 11:00
  • This solution doesn't work for me either. Just copying+renaming standard WixUI_* file and renaming one ID gives bunch of "LGHT0091: Duplicate symbol ..." errors. Probably this method is not suitable for using in VS2010 where I have a Reference to WixUIExtension.dll. Removing the reference removes all standard dialogs which are used in WixUI_* file. So this is not problem of customization of standard dialogs but customization of standard dialogs using Visual Studio project. – VikVik Nov 16 '12 at 19:24
  • @VikVik, you don't copy the all the WiX UI .wxs files, just the main one that contains the flow of the UI. See the WiX manual: http://wix.sourceforge.net/manual-wix3/WixUI_customizations.htm – BryanJ Nov 16 '12 at 20:04
  • @BryanJ Sure I copy only one file, rename it and change the ID. After this I have 22 errors like this: `\WixUI_MinimalCustom.wxs(56,0): error LGHT0091: Duplicate symbol 'ControlEvent:WelcomeDlg/Next/NewDialog/VerifyReadyDlg/Installed AND PATCH' found. This typically means that an Id is duplicated. Check to make sure all your identifiers of a given type (File, Component, Feature) are unique. \wixlib\WixUI_Minimal.wxs(56,0): error LGHT0092: Location of symbol related to previous error. ` – VikVik Nov 19 '12 at 14:56
3

Finally I found an eye opener article on wix here How to add custom UI

After a long struggle to understand how wix works, the above link to codeproject helped me understand. Especially the part that explains creating UI (MyWebUI.wxs in that article) was the life saver.

coder
  • 4,121
  • 14
  • 53
  • 88
  • 1
    Thanks for the link. Even though the article is pretty outdated I was able to learn a lot. I realized that I should not copy the source file in my customized dialog set, but just reference a standard dialog and inject my custom dialogs by publishing (overriding) the actions on Next/Back: http://www.codeproject.com/Articles/115036/Creating-WIX-Installer-for-ASP-NET-Web-Application#h45 – VikVik Nov 16 '12 at 19:35