views:

511

answers:

2

I've created my first database based desktop app in .NET and not able to understand how can I deploy the database with the application installer, so that the database, application and the SQL Server is installed in one go.

If I only deploy the native client for SQL Server and the database with the installer, will it work?

The application uses the database very frequently.

+1  A: 

Using click once you can make sql server express a dependency of the main project and it would be deployed with the instalation data and installed, if it is not instaled yet, when you first install your app.

You can do it in the project properties, in Visual Studio.

j.a.estevan
I was thinking about it, but it doesn't offers much(or any) customization for the setup. I was thinking what will it be possible to simple deploy the native sql client and the database with the app and it would work?
Vikas
If you deploy the free downloadable package of sql server express from microsoft, it will work as it includes the sql engine and the basic client and drivers for it to work. But it will require a manual instalation from the final user, if needed.
j.a.estevan
@Vikas: in addition to the SQL client and the database file (MDF), your users will also need a copy of the SQL Express database engine; as this answer says, Click Once is the best way to do that. If you want to avoid having your users install a separate app, you might consider switching to SQL Server Compact edition, which can be embedded in your app.
RickNZ
+3  A: 

You need to install the SQL Express engine if you want to use it. Deploying only the client connectivity will give you exactly what the 'client connectivity' name implies: you'll be able to connect to a SQL Server. But only a running SQL Server instance will be able to read/write your application database.

The SQL Express install MSI is actually very customizable and allows for a lot of scenarios, including unattended setup and remote deployment. For the most basic options, see Configuring SQL Express During Installation. Your application installer will have to invoke the Express installer passing in the desired parameters.

Remus Rusanu