5

I currently am writing my own CLR Stored Procedure and I need to use a solver from Microsoft Solver Foundation.

In order to be able to add the reference to Microsft Solver Foundation in my CLR Project, I need to add that assembly to my SQL Server instance (source). So I installed MS Solver Foundation Redistributable and registered it in SQL Server using the following script as server admin:

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

However, I get the following error:

Assembly 'MicrosoftSolverFoundation' could not be installed because existing policy would keep it from being used.

Additional Information

CLR Version:

directory   C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
version v4.0.30319
state   CLR is initialized

SQL Server Version:

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)
Community
  • 1
  • 1
Cristiano Sousa
  • 934
  • 1
  • 6
  • 31

1 Answers1

0

This MSDN post seems to talk about the same thing, and recommends using the mscorcfg.msc tool to look at the Runtime Security Policy.

It also mentions the Fusion Log Viewer to see if anything is being logged while you are trying to create the assembly.

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/6546340a-2cf7-4308-88d0-c403cebdb66b/create-assembly-error-could-not-be-installed

jlee-tessik
  • 1,510
  • 12
  • 16