问题描述
我正处于在客户端/服务器场景中构建Vb.Net WinForms应用程序的最后阶段(表单存储在SQL Server中的数据之上)
I'm in the final stages of building a Vb.Net WinForms app in a client/server scenario (forms over data stored in SQL Server)
在这个特定项目中,我们不会部署软件,因此我们正在寻找一种使安装过程中数据库部分尽可能自动化的方法.
In this particular project we won't be the ones deploying the software so we're looking for a way to automated the Database part of the setup as much as possible.
客户端应用程序正在与ClickOnce一起部署,因此已进行排序.
The client application is being deployed with ClickOnce, so that's sorted.
关于数据库设置,您能建议自动执行此操作的最佳方法吗?通常,部署将是这样的(这是我们想要自动化的):
As for the Database setup, can you advise on the best way to automate this?Typically the deployment would go like (this is what we'd like to automate):
-
在混合模式身份验证中将SQL Server Express Edition作为单个实例安装(我们必须使用混合模式,因为我们不能保证拥有AD.) (如果可能的话,请用户在安装过程中指定SA密码,否则,我们可以将其设置为预设值)
配置实例以使用固定的TCP/IP端口
Configure the instance to use a fixed TCP/IP port
在Windows防火墙中打开TCP/IP端口
Open the TCP/IP port in the Windows Firewall
最后运行一个SQL脚本以创建数据库(表/存储的proc/基本日期)
Finally run a SQL Script to Create the DB (Tables/stored procs/base date)
请记住,我们正在使用Visual Studio Express,因此我们没有InstallShield或应用程序安装"模板.
Please bear in mind we're using Visual Studio Express so we don't have InstallShield or the "Application Setup" template.
您能根据您的最佳行动建议/建议吗?
Can you please advise/suggest on the best course of action base don your experience?
谢谢佩德罗.
推荐答案
我以前在应用程序中附带过sql,这可能是很痛苦的-您可以编写安装脚本,但是它很复杂且容易出错.
I have shipped sql in apps before and it can be a right pain - you can script the install but it is complicated and error prone.
您是否需要使用sql server express,也许精简版会给您您想要的?部署要简单得多.
Do you need to use sql server express, maybe compact edition will give you what you want? The deployment is a lot simpler.
如果您确实需要分发它,并且您不希望用户自己设置它,则可以看看如何对其进行虚拟化,可以使用spoon.net进行它,因此无需进行任何设置,只需启动该exe文件即可.程序启动时-这样,您可以使用安全的sa密码等进行任意配置,然后下载并运行.
If you do need to distribute it and you don't want the users to set it up themselves you could look at virtualizing it, you can do it with spoon.net so there is no setup to do, just launch the exe when your program starts - this way you can configure it as you like, with secure sa password etc and just download and run.
步骤说明:
勺子很便宜,在这种情况下太棒了!
Spoon is pretty cheap and in cases like this is awsome!
编辑
这篇关于创建VB.Net程序+ SQL Server&的自动安装程序脚本来创建数据库&用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!