Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to install C# windows service with database.

I need to create installer like that:

1. check if there is SQL Server 2008
2. if can't find SQL Server - than ask client to choose the path or leave.
3. check if there is .NET Framework 4.0
4. Eventually install .NET Framework 4.0 - if it's missing

5. Connect and log into SQL Server,
6. Create tables, procs etc (run sql scripts)..

7. Install windows service from cmd line. In this point I also have to setup the connectionstring in my app.config - is that possible?)


I thought, Inno Setup will be good tool - but now I don't know if it's possible with that tool?

Could you help me, how to do that? Specially with that database. I have no idea how to connect to sql server and create database with tables, from Inno setup for example. Please help.
Posted
Updated 28-Jul-11 12:45pm
v2

1 solution

I've never used Inno setup, but I've never seen a setup program that can do that. Requiring .NET 4 is easy. SQL Server is a commercial product, so you're better off, as the user has to set up a connection string anyhow, just asking the user for that and/or checking if SQL Server appears to be present as part of the initial first run of the program. This also allows a user to finish installing your program first, then install SQL Server. How do you install the DB to SQL Server ? I'd run scripts from inside your program, this also allows the user to do that to reset the DB, or set up a new one.
 
Share this answer
 
Comments
mnd017 29-Jul-11 8:29am    
Thank you, that is a good idea. I will do that like this:
1. First install windows service (with .net framework and config-application)
2. Next step for user will be open config-application, and set up database settings (only at first step) - connection string, create database with tables ect (using sql scripts.
3. And final step will be Start windows service.
I think that is a good idea.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900