使用.NET 3.5组件SQL 2005 CLR?组件、NET、CLR、SQL

2023-09-04 10:41:24 作者:一个人走过孤独

我有一个CLR存储过程引用了使用LINQ在VS 2008中创建的组件。让我们把这个集'MyLib中。

I have a CLR stored procedure that references an assembly created in VS 2008 that uses Linq. Lets call this assembly 'MyLib'.

我似乎无法得到'MyLib中'到我的SQL 2005数据库。我做到以下几点:

I can't seem to get 'MyLib' into my SQL 2005 database. I do the following:

CREATE ASSEMBLY [MyLib]
    FROM 'C:\MyLib\bin\Release\MyLib.dll'
WITH PERMISSION_SET = UNSAFE
GO

但我得到的错误:

But I get the error:

Assembly 'MyLib' references assembly 'system.core, version=3.5.0.0, 
culture=neutral, publickeytoken=b77a5c561934e089.', 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(error not found)). Please
load the referenced assembly into the current database and retry your request.

有没有更简单的方式来获得所有的.Net 3.5组件到SQL 2005 CLR,其他比我写了一个CREATE ASSEMBLY命令为每一个?是否有这样做的一些最佳实践的方式?

Is there an easier way to get all of the .Net 3.5 assemblies into the SQL 2005 CLR, other than me writing out a 'CREATE ASSEMBLY' command for each one? Is there some "best practice" way of doing this?

推荐答案

查看这个线程。基本上,你必须手动得到新的组件来加载,而不是它们被自动从全局程序集缓存加载的。

Check out this thread. Basically you have to manually get the new assemblies to load, instead of them being loaded automatically from the global assembly cache.

(CLR的版本2.0和3.5是一样的)

(the CLR for version 2.0 and 3.5 is the same)