在安装和部署中嵌入SMO dll [英] Embedding SMO dlls in Setup and deployment
问题描述
我有一个.NET集合和部署项目,它必须执行一组真正长的SQL脚本作为安装过程的一部分。我已经使用SMO dll调用.sql脚本文件。但是这些SMO dll不是.NET框架的一部分,而是与SQL Server 2005或2008捆绑在一起。现在,如果安装程序在一台机器上运行没有SQL Server 2005/2008安装SQL脚本执行失败。这是我的设置的完美有效的用例,因为用户可能在他的本地机器上但在网络服务器上没有SQL服务器。
如何将SMO dll与setup.msi一起嵌入,以免它依赖于正在运行的机器上的任何SMO DLL?
I have a .NET Set and Deployment project which has to execute a set of really long SQL Scripts as a part of the installation process. I have used SMO dlls to make calls to the .sql script files.These SMO dlls are however not a part of the .NET framework but they come bundled with SQL Server 2005 or 2008. Now, if the setup is run on a machine which does not have SQL Server 2005/2008 installed the SQL script execution fails. This is a perfectly valid use case for my setup as the user might not have SQL server on his local machine but on a network server. How do i embedd the SMO dll's along with the setup .msi so that it doesnt have to depend on any SMO dlls on the machine it is being run?
推荐答案
很抱歉,我一眼就不明白这个问题。我将执行以下操作:
I'm sorry, I didn't understand the question at first glance. I would do the following:
- 创建自定义安装程序项目(类库)
- 添加引用SMO DLL(我想你必须设置Copy Local = True)
- 使用您的sql部署逻辑向其添加安装程序类
- 将此项目的输出添加到您的安装项目
- 设置必要的自定义操作
- Create a custom installer project (Class Library)
- Add a reference to the SMO DLLs (I think you have to set Copy Local = True)
- Add an installer class to it with your sql deployment logic
- Add this project's output to your setup project
- Setup the necessary custom actions
本文解释了类似的过程(减去SMO调用),它基于此msdn文章。
This article explains a similar process (minus the SMO calls), it's based on this msdn article.
希望有帮助!
这篇关于在安装和部署中嵌入SMO dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!