本文介绍了嵌入SMO动态链接库的安装和部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.NET设置和部署项目,必须执行一组很长的SQL脚本,在安装过程中的一部分。我已经使用SMO动态链接库来调用的.SQL脚本files.These SMO的DLL但不是.NET Framework的一部分,但他们来与SQL Server 2005或2008捆绑现在,如果安装程序运行在机器上不具有SQL Server 2005/2008安装了SQL脚本执行失败。这是一个非常有效的使用案例,我的设置作为用户可能没有SQL服务器上他的本地机器,但在网络服务器上。我该如何使嵌入的SMO的DLL一起安装的.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:

  1. 创建一个自定义安装项目(类库)
  2. 添加引用SMO的DLL(我认为你必须设置复制本地=真)
  3. 添加一个安装程序类,它与你的SQL部署的逻辑
  4. 在该项目的输出添加到您的安装项目
  5. 设置必要的自定义操作

本文解释类似的过程(减去SMO调用),它基于这个MSDN文章

This article explains a similar process (minus the SMO calls), it's based on this msdn article.

希望帮助!

这篇关于嵌入SMO动态链接库的安装和部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 15:56