I have written a solution in VS 2015 which is architected such that a C# WinForms front-end can access the App Engine, which does the work. The C# WinForms app can be installed using ClickOnce, or I suppose I can make an installer for it using WiX Installer if I had to.
My App Engine is simply a SQL Client application designed to install SQL Server Express Edition and also install the database it uses, which is packaged into a DACPAC.
So far so good. In VS2015, I have one solution which contains the following assemblies:
- Database Project (DAC)
- App Engine (DLL)
- C# Winforms Front End (EXE)
- Possibly a Setup project using WiX Installer
Now how do I deploy the C# WinForms app to a fresh workstation that does not have anything on it? I would like to install using the ClickOnce technology, and avoid using WiX because it shouldn't be a complex install.
So I realize I can install the C# WinForms app and declare a dependency on SQL Server Express Edition. This causes the SQL Server Express Edition msi to deploy first, followed by my C# WinForms app, but there is no database yet!
So I read further, and found that I either need SqlPackage.exe or DacFx to unpack and install the database.
- Which project do I put the DacFx into? This should be a pretty common scenario.
- If the WinForm detects that there isn't a database responding to the SQL Client on the first load, should I put the DacFx database installer code into that event?
- If not, how do I put the DacFx or SqlPackage.exe calls into the installer?
Basically, are there any best-practices for executing SETUP.EXE and achieving an install of SQL Express + Database + Application?