2013-07-04 92 views
0

我已經寫了一個CLR storedprocedure,一切都很好,直到今天我已經介紹了一個新的DLL,我試圖註冊一些第三方庫到SqlServer 2008 R2,但是當我運行這個命令:註冊windowsbase程序集SqlServer CLR

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. 

沒有3.0版本出現在C:\ WINDOWS \ Microsoft.Net除了V4.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. 

它看起來像有windowsbase的V3.0,但我唯一能找到的關於4.0版。

任何人都可以幫助我!

在此先感謝

馬爾科

回答

1

難道這是任何幫助嗎?

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

編輯:正如馬修指出的,可能無法正常工作。不幸的是,這可以在SQL Server上運行到2008 R2。在較新的版本中(出於安全性/穩定性的原因?)一些CLR程序集是不允許的,所以你必須調用本地DLL(這是很不安全/穩定)。

+0

Msg 6586,Level 16,State 1,Line 5 無法安裝'WindowsBase'程序集,因爲現有策略會阻止它被使用。 –