Creating a database through Windows Installer (WIX)
Brian Donahue
Posts: 6,590 Bronze 1
Hi all,
Since SQL Packager is meant to ease the process of creating a database by creating a copy on different servers, it makes sense to want to embed a SQL Packager "package" as part of a Windows Installer (MSI) file. Unfortunately, we have not been so enthusiastic about creating examples demonstrating how you could do this, so I have created a WiX-based installer that will install a database created using SQL Packager.
The example WiX project contains all of the WiX XML files and a sample database. A customized user interface is demonstrated, showing a form where the installer can collect information about the destination server and database name, and ultimately save these values to the registry so they can be re-used at uninstall (or upgrade) time.
Please feel free to have a look at my blog, and post any comments to this forum.
I hope that you all get some useful information from this!
Since SQL Packager is meant to ease the process of creating a database by creating a copy on different servers, it makes sense to want to embed a SQL Packager "package" as part of a Windows Installer (MSI) file. Unfortunately, we have not been so enthusiastic about creating examples demonstrating how you could do this, so I have created a WiX-based installer that will install a database created using SQL Packager.
The example WiX project contains all of the WiX XML files and a sample database. A customized user interface is demonstrated, showing a form where the installer can collect information about the destination server and database name, and ultimately save these values to the registry so they can be re-used at uninstall (or upgrade) time.
Please feel free to have a look at my blog, and post any comments to this forum.
I hope that you all get some useful information from this!
Comments
I'm my companies installer guy. I'm trying to run a package made with redgate packager 5 as part of an installation using an msi made from WiX. I've tried a few ways of invoking the .msi including the one you posted on your blog, but whenever I run the package I get the following error:
CAQuietExec: File or assembly name redgatepackage.exe, or one of its dependencies, was not found.
The package works fine if I run it from command line or just double click it in windows.
This error does not occur if I exchange the redgatepackage.exe with another .net .exe keeping everything else the same so I'm fairly sure the .exe is being invoked correctly, but for some reason the redgate package doesn't like being invoked indirectly like this.
Any ideas?
Chris.
I'm sure that this is a WIX issue. I think that, if you want to use CAQuietExec in this way, that you need to ensure that you use Execute="deferred" and Return="check". You may want to use filemon or process explorer to make sure that your package file is extracted before the custom action runs.
It seems to be a working directory issue.
Value=""[SQLPACKAGEFOLDER]SQLPackagerBaseline.exe" /server:[SERVERNAME] /database:[DATABASENAME] /quiet /makedatabase"
did not work for me as the working directory was the defualt C:\WINNT\System32. I've come up with a way to change this and redgatepackage.exe runs fine.
Thanks.