我有一个引用外部程序集的CLR项目。我首先创建了引用的程序集,如下所示:
CREATE ASSEMBLY [GraphClient]
FROM 'C:\Users\rknight\Desktop\GraphServerClientProject\GraphServerClient\GraphClient\GraphClient\bin\Debug\GraphClient.dll'
WITH PERMISSION_SET = UNSAFE
然后在我的CLR项目中,我能够在“SQL Server”选项卡下引用它。构建了CLR项目,它编译时没有错误。但是当我创建新程序集时出现错误:
CREATE ASSEMBLY [GraphCLR]
FROM 'C:\Users\rknight\Desktop\GraphServerClientProject\GraphServerClient\GraphClient\GraphCLR\bin\Debug\GraphCLR.dll'
WITH PERMISSION_SET = UNSAFE
Msg 10301, Level 16, State 1, Line 1
Assembly 'GraphCLR' references assembly 'graphclient, version=0.0.0.0, culture=neutral, publickeytoken=null.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.
答案 0 :(得分:2)
我遇到了这个问题,我最终解决了这个问题。我在64位服务器上引用了x86程序集。我将引用的程序集重建为Any CPU,安装在服务器上,重新添加对项目的引用,将项目重建为Any CPU,然后然后 SQL Server可以解析引用并安装程序集
“您正在引用为错误平台构建的程序集”这样的消息会非常有用:)
答案 1 :(得分:1)
这应该有效。您是否在尝试GraphCLR部署之前成功加载了GraphClient?我没有依赖数据库项目正确部署,而是首先按正确的顺序手动加载dll,然后如果可行则返回并弄乱项目以确保依赖关系正确并且部署正确排序。
如果这没有帮助,您是否尝试过设置可信赖以消除任何模糊的权限问题?