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?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s