0

我已经编写了一个 CLR 存储过程,直到今天我引入了一个新的 dll 并且我正在尝试将一些第三方库注册到 SqlServer 2008 R2 但是当我运行以下命令时,一切都很好:

CREATE ASSEMBLY [DevExpress.Data] FROM 'C:\MyProject\DevExpress.Data.v12.2.dll' WITH PERMISSION_SET = UNSAFE

SqlServer 向我抛出一个错误:

Assembly 'DevExpress.Data.v12.2' references assembly 'windowsbase, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35.', 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(failed to retrieve text for this error. Reason: 15105)). Please load the referenced assembly into the current database and retry your request.

除 v4.0 外,c:\Windows\Microsoft.Net 上没有 3.0 版本,所以当我运行时

CREATE ASSEMBLY [WindowsBase] FROM 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\WindowsBase.dll' WITH PERMISSION_SET = UNSAFE

SqlServer 向我抛出另一个错误:

CREATE ASSEMBLY for assembly 'WindowsBase' failed because the assembly is built for an unsupported version of the Common Language Runtime.

看起来有一个 v3.0 的 windowsbase,但我能找到的唯一一个是 v4.0。

任何人都可以帮助我!?

提前致谢

马可

4

2 回答 2

1

这有什么帮助吗?

CREATE ASSEMBLY [WindowsBase]
FROM 'C:\Windows\assembly\GAC_MSIL\WindowsBase\3.0.0.0__31bf3856ad364e35\WindowsBase.dll' 
WITH permission_set = unsafe 
go

编辑:正如马修指出的那样,可能行不通。不幸的是,这适用于最高 2008 R2 的 SQL Server。在较新的版本上(出于安全/稳定性原因?)某些 CLR 程序集是不允许的,因此您必须调用本机 DLL(安全/稳定性要低得多)。

于 2013-08-21T08:28:35.867 回答
0

它对我来说是这样的:

create assembly [WindowsBase]
from'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WPF\WindowsBase.dll'
with permission_set = unsafe;
于 2021-08-02T13:17:51.827 回答