Notes on Wix
I’ve been really digging into Wix over the last couple days to move along the installer for my side project.Currently, the installer installs four things:
- Sql Server database
- MonoRail web application
- Windows service
- Console application
What I need to do now is allow the user to pick a server to install the database on (hardcoded as the local machine right now) and also specify a sql username/password to run the database setup scripts with (also hardcoded as the ’sa’ account). This turns out to be non-trivial. Based on my research it looks like I’ll have to write a custom dialog in my .wxs file that contains the text fields that I want the user to fill in, and then bind those text boxes to the corresponding Wix properties.
I wish there was a way to have Wix generate the dialog for me, especially in the case where I just need some text boxes, nothing too fancy.
When getting the Monorail web app installation working, I discovered the ability of tallow.exe to examine a directory structure and generate the corresponding Wix fragment to make that structure get installed. So I just ran that command on my build folder and I saved myself the hassle of typing each file into my .wxs file. I didn’t see a way to send the output of tallow to a file though, but you can just redirect the command line output to a file like this:
tallow.exe -d DIR-TO-MIRROR -dav > FILE-TO-OUTPUT
One thing that tallow won’t do for you though is generate guids in the appropriate places, so I had to go through and do a big find/replace. Still saved me a lot of time though.
After I get the database installation issues sorted out, I’m moving on to allowing the user to pick which web site to install the Monorail application under, currently the installer just assumes the web site at port 80, but I can’t really assume thats where everyone will want it located. The interface for that will be more complicated than the database setup, so I want to make sure I’m doing things right.
Aaron Feng said,
Wrote on June 4, 2007 @ 7:24 pm
If you are interested in doing custom interface for users to enter in data, I would suggest WixEdit. No more guessing pixels, and it will save you tons of time. I have done a custom screen that allows users to enter in virtual directry, database connection string, and even optionally create the schema and encrypt the connection via DPAPI. Using WiXEdit and manually altering the WiX file, took no time to get that job done. Word of advice; it would be nice to have a test connection button to allow users to make sure the connection string is actually valid before it finishes installing. It will save your users a lot of time from debugging, and they will appreciate it.
ben said,
Wrote on June 14, 2007 @ 10:17 am
Aaron, thanks for the tip! I just downloaded WixEdit and played around with it for a few minutes, this looks very promising. Even if it can’t do everything it can certainly get you 85% of the way there.
Dave Palmer said,
Wrote on July 24, 2007 @ 9:41 am
While Installing Database are you able to check for any error. I am trying as ->
Also any suggestion about how to execute more then 1 SQL files.
ben said,
Wrote on July 24, 2007 @ 5:57 pm
Dave, whenever my installer would hit an with the database,error, I would get an unfriendly error message and then it would roll back the installation, which was good enough for me.
As far as running multiple sql files, I would imagine it would be the same as running a single file, just with multiple entries for each file you want to run. I would point you to the tutorial located here:
http://www.tramontana.co.hu/wix/lesson7.php
That site has a lot of great stuff on getting started with Wix.