如何在Inno Setup中创建安装文件以使用数据库安装C#应用 [英] How to create setup file to install C# app with database in Inno Setup
问题描述
我需要使用数据库安装C#Windows服务.
我需要这样创建安装程序:
1.检查是否有SQL Server 2008
2.如果找不到SQL Server,则要求客户端选择路径或离开.
3.检查是否有.NET Framework 4.0
4.最终安装.NET Framework 4.0-如果缺少它
5.连接并登录到SQL Server,
6.创建表,proc等(运行sql脚本)..
7.从cmd行安装Windows服务.在这一点上,我还必须在我的app.config中设置连接字符串-可以吗?)
我以为Inno Setup将是一个很好的工具-但现在我不知道该工具是否可行?
你能帮我,怎么做?特别是那个数据库.我不知道如何连接到sql server并使用表创建数据库,例如从Inno设置中.请帮忙.
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.
推荐答案
我从未使用过Inno设置,但是我从未见过可以执行此操作的安装程序.要求.NET 4很容易. SQL Server是一种商业产品,因此您的境况会更好,因为用户无论如何都必须设置连接字符串,只需询问用户和/或检查SQL Server是否作为最初的一部分出现在服务器中即可.运行该程序.这也使用户可以先完成程序的安装,然后再安装SQL Server.如何将数据库安装到SQL Server?我将从程序内部运行脚本,这还允许用户执行此操作以重置数据库或设置新的数据库.
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.
这篇关于如何在Inno Setup中创建安装文件以使用数据库安装C#应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!