Deploying SQL Compact databases – Part III

I ended up using ClickOnce deployment instead of Windows Installer after all! This is because I uninstalled the beta of VS2008 and installed the "proper" version of VS 2008 Express - which doesn't support Setup projects. ClickOnce is fairly easy to set up - the only thing that I couldn't work out was how to get it to notice Content files in dependant projects for deployment purposes i.e. the .sdf file that is the database for the application is in another project, and doesn't get picked up by the ClickOnce publisher. So I had to move the .sdf file into my main project that is published - not ideal but not the end of the world. I have also then found that after installing and running the first time, occasionally after the install, the database file can't be found by the application. Once you run it a second time, it works fine - but the first time on install it doesn't always work. Weird.


Deploying SQL Compact databases in VS 2008 installer packages

I'm writing a C# small application in VS 2008 which has a SQL Compact (.sdf) database used to persist data (funnily enough). I'm writing the installer package for it - wondering whether to use standard Windows installer technology or ClickOnce. I'm leaning towards the former because it seems like I'll get more control over it that way. I need to be able to ensure that the connection string to the SDF file is correct. Bear in mind that I'm using the connection string setting that is created when you hook up the sdf to your DataSet - so I'll need some way of changing the app.config file post-install. I imagine that I should also run some check to see if the database already exists or not in the location (as if the user is installing a newer version over the top they wouldn't want to lose all their data). I have no idea how to go about writing custom install-time tasks like this. Anyone got any ideas?