gpt4 book ai didi

c# - 无法加载文件或程序集 'Microsoft.SqlServer.Smo,版本 = 10.0.0

转载 作者:太空宇宙 更新时间:2023-11-03 16:23:58 24 4
gpt4 key购买 nike

  • 操作系统:Microsoft Windows NT 5.2.3790 Service Pack 2 版本:2.0.50727.42

正在做:创建表...

Rec: system.m.FileNotFoundexception: could not load file or assembly 'microsoft.sqlserver.smo, version=10.0.0.0, culture=neutral File name: 'microsoft.sqlserver.smo, version=10.0.0.0, culture=neutral, PublicKeyToken=89845dcd8080cc91' at claimsure.Forml.Runsqlscript(string connstring, streamReader sr) at myapp.Forml.bw_Dowork(object sender, DoworkeventArgs e) 'MN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value (NKLm\software\microsoft\Fusion!enableLog] (DwoRD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value (NKLm\software\microsoft\Fusion!enableLog).

在装有 SQL Server 2005 的 Windows 2003 服务器上运行我的应用程序时出现上述错误。

我知道有一个解决方案可以从 http://www.microsoft.com/en-us/download/details.aspx?id=24793 下载 SQLServer2005_XMO

我已经这样做了,但是安装后需要重启服务器,暂时不可行。

我需要使用服务器对象。

 using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;

using (SqlConnection connection = new SqlConnection(connString))
{
Server server = new Server(new ServerConnection(connection));
server.ConnectionContext.StatementTimeout = 2400;
server.ConnectionContext.ExecuteNonQuery(sqlString);

}

是否可以将 dll 加载到与我的应用程序相同的目录中并从代码中引用它?

谢谢。

编辑:添加了完整的错误

最佳答案

通过构建 MSI 安装程序并包含所有必需的 DLL 解决了这个问题。谢谢指点。

关于c# - 无法加载文件或程序集 'Microsoft.SqlServer.Smo,版本 = 10.0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13090319/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com