Wednesday, March 7, 2012

Installation of SQL Express from my MSI

I've written an application that needs to also deploy SQL Express. In the MSI for my application, I want to install SQL Express. The problem is that when I call sqlexpr.exe, I eventually get an error that it can't install because another instance of MSI is currently running (my instance). I've seen posts on doing silent installs of SQL Express by extracting the setup package and calling setup.exe directly with a modified settings file, but this still does not solve my problem that it will start up a new instance of MsiExec.exe.

I think that I need to do a nested install of the SQL Express MSI from my MSI. I've found several msi's in the setup subdirectory, but which do I needs to call, in what order, and how do I configure them to install the engine in my own named instance of SQL Express?

ThanksMichael,

You need to write a bootstrapper for your application because SQL Server Express is ultimately an MSI based installation and Windows Installer cannot run more than a single MSI at a given time - in other words, an MSI cannot call another MSI. Don't let the fact that SQL Server Express is wrapped in a self-extracting executable fool you. SQLEXPR.EXE expands into a setup.exe and several MSIs. Setup.exe is launched automatically which will then call each of the MSIs in serial fashion. We're working on a white paper that walks through exactly how to embed Express in a custom application but it's not quite ready yet.

In the mean time, you should expand the SQLEXPR.exe package to a folder using SQLEXPR.exe /X, you'll be prompted for a folder to expand to. Once the package has been expanded take a look at the template.ini file. This will give you a list of command line parameters you can use for installing Express. These can be passed directly into SQLEXPR.exe which will in turn pass them to Setup.exe. Passing the /qn switch will cause SQL Server Setup to run in fill quiet mode - no GUI.

Your command line should look something like "sqlexpr.exe /qn ADDLOCAL=SQL_Engine INSTANCENAME=Foobar"

I believe that Visual Studio has help information on creating a setup bootstrapper.

Good luck and keep your eyes open for the white paper - it'll be posted to MSDN.

Cheers,
Dan

No comments:

Post a Comment