Tag Archives: wix

Connecting to a SqlExpress instance with Wix

The other day I came across a bit of a strange issue when trying to delploy a backup to a fresh SqlExpress 2008 R2 instance. I had setup the Wix Sql database tag using a loopback address:

<sql:SqlDatabase Id="DbNameRef"
                 Database="DbName"
                 Server="127.0.0.1"
                 Instance="SQLEXPRESS"
                 CreateOnInstall="yes"
                 DropOnUninstall="yes"
                 User="MySQLUser"
                 ContinueOnError="yes">

but for some reason it wasn’t connecting at all just erroring with a most helpful error message:

CreateDatabase:  Error 0x80004005: failed to create SQL database but continuing, error: unknown error, Database: [DATABASE_NAME]

I enabled TCP/IP so that I could use sql profiler and re-ran the installer hey presto guess what it worked! Obviously as SqlExpress only installs with “Shared memory” enabled this was the issue, it couldn’t connect. I tried the sqlcmd method of using “lpc:” as a prefix but still no joy. It turns out that if you cannot use a hostname or ip for the servername to switch over to shared memory’ you have to use “.” as the server name:

<sql:SqlDatabase Id="DbNameRef"
                 Database="DbName"
                 Server="."
                 Instance="SQLEXPRESS"
                 CreateOnInstall="yes"
                 DropOnUninstall="yes"
                 User="MySQLUser"
                 ContinueOnError="yes">

Setting up your environment to build the Wix3.6 sources

Recently I have been back creating Wix installers and unfortunately I came across a a bug in the RC0 that was causing issues with my Burn bootstrapper. This had already been fixed in the latest sources so I went ahead and built the latest sources. This wasn’t as easy as I though it would be so here are the steps I needed to take:

  1. Install the Windows SDK 7.1 (http://www.microsoft.com/en-us/download/details.aspx?id=8279) (I just did a full install)
  2. Install Mercurial (http://mercurial.selenic.com/)
  3. Clone the latest Wix sources into a local folder (hg clone https://hg.codeplex.com/wix)
  4. Change directory to the new wix folder.
  5. Switch to the Wix36 branch (hg update wix36).
  6. Setup an environment variable called WIX_ROOT pointing to your newly downloaded sources (In my case C:\source\codeplex\wix).
  7. Open up a VS2010 command prompt in administrator mode and navigate to the WIX_ROOT path.
  8. Run make.bat.

Now once that is completed, hopefully you should only have non-fatal errors and warnings an if that is the case the latest wix installer will be located under %WIX_ROOT%\build\debug\x86\release\%WIX_VERSION%\.