我目前正在编写自己的 CLR 存储过程,我需要使用 Microsoft Solver Foundation 的求解器。
为了能够在我的 CLR 项目中添加对 Microsft Solver Foundation 的引用,我需要将该程序集添加到我的 SQL Server 实例(源)中。所以我安装了 MS Solver Foundation Redistributable并使用以下脚本作为服务器管理员在 SQL Server 中注册它:
USE MYDB
ALTER DATABASE MYDB SET TRUSTWORTHY ON WITH ROLLBACK IMMEDIATE
ALTER DATABASE MYDB SET TRUSTWORTHY ON
CREATE ASSEMBLY MicrosoftSolverFoundation
AUTHORIZATION dbo
FROM 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Microsoft.Solver.Foundation.dll'
WITH PERMISSION_SET = UNSAFE
但是,我收到以下错误:
Assembly 'MicrosoftSolverFoundation' could not be installed because existing policy would keep it from being used.
附加信息
CLR 版本:
directory C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
version v4.0.30319
state CLR is initialized
SQL 服务器版本:
Microsoft SQL Server 2012 (SP1) - 11.0.3128.0 (X64)
Dec 28 2012 20:23:12
Copyright (c) Microsoft Corporation
Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)