问题描述
ClickOnce或InstallShield可以设置或配置SQL Server或SQL Server Express,专门添加 sa
密码,启用命名管道,授予从文件夹读取的权限,添加主数据库(客户端应用程序所需的 .mdf
文件。
Can ClickOnce or InstallShield setup or configure SQL Server or SQL Server Express specifically adding an sa
password, enabling named pipes, granting permission to read from folders, adding primary database (.mdf
files) needed for my client application.
还是我需要从我的代码中硬编码这些功能客户端应用程序?
Or do I need to hard-code those functions from my client app?
推荐答案
是的,但是……ClickOnce可以像这样安装依赖项,但是由于SQL Server安装的性质,我个人会避免这样做。对于那些着急或不喜欢在发生问题时处理怪异问题的人来说,这不是一项任务。要显示这是多么微不足道,您可以查看帖子和。
Yes, but...... ClickOnce can install dependencies like this, but due to the nature of the SQL Server install I personally would avoid doing it that way. It's not a task for those in a hurry or who don't like dealing with weird problems when things go wrong. To show how non-trivial this can be you can check the posts How to deploy SQL Server 2008 Express as a prerequisite with ClickOnce and ClickOnce Prerequisites: where is SQL Server Express 2014 LocalDB?.
InstallShield可以做到吗?
是的,但是可能并且可能会有曲线球。您可以这样操作:
Yes, but there can and probably will be curveballs. You could do it as:
- 链式安装。 讨论了如何使用链接的MSI 。
- 包括安装程序中的InstallShield SQL Server Express必备软件包(如)
- a chained install. This whitepaper talks about how to use a chained MSI.
- including the InstallShield SQL Server Express prerequisite package in your installer (as mentioned here)
个人不会使用它这两种方式中的任何一种-相反,我将编写一个自定义操作,该操作调用SQL安装程序并传递收集的参数(即SQL的安装位置,初始登录的密码等)。 SQL安装也不严格是事务性的-在安装过程中可能会失败,并且某些更改不会撤消。
Personally wouldn't approach it either of these ways - instead I would write a custom action that invokes the SQL installer and passes in the parameters gathered (i.e. install location for SQL, passwords for initial logins, etc.). The SQL install is also not strictly transactional - it can fail during the install and some changes will not be reversed.
如果您设法将它们组合在一起作为安装程序的引导程序,注意诸如。
Should you manage to put this together as an installer bootstrapper, be aware of issues like Can't install SQL Server by using InstallShield or bootstrapping application.
我也建议您为用户提供安装SQL Server的选项,因为他们可能已经有可用的实例了-尝试不要始终安装它。
I would also advise you to offer the user the option of installing SQL Server as they may already have an instance available - try not to install it always.
这可以通过多种方式完成,但是在MSI安装程序中完成所有操作的过程却开始变得异常复杂-为最终用户编写简单的配置实用程序会变得更加简单快捷,或将功能内置到您的应用程序中。
This can be done in a variety of ways, but doing it all within the MSI installer is starting to get horribly complex - it can be far simpler and quicker to write a simple configuration utility for the end user, or to build the functionality into your application.
创建数据库和配置SQL实例的方式在很大程度上取决于您的要求,而您在问题中未指定。
How you go about creating the database and configuring the SQL instance is heavily dependent on your requirements, which you haven't specified in your question.
这篇关于ClickOnce或InstallShield可以设置SQL Server或SQL Server Express吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!