C# 在SQL Server中创建NationalInstruments.Common.Native.dll
我编写了一个要部署到SQL Server 2012数据库的存储过程。编写的存储过程引用了许多程序集,包括C# 在SQL Server中创建NationalInstruments.Common.Native.dll,c#,sql-server,visual-studio-2012,sql-server-2012,.net-4.5,C#,Sql Server,Visual Studio 2012,Sql Server 2012,.net 4.5,我编写了一个要部署到SQL Server 2012数据库的存储过程。编写的存储过程引用了许多程序集,包括NationalInstruments.Common.Native.dll 尝试发布存储过程时,出现以下错误: SQL72014:.Net SqlClient数据提供程序:Msg 6503,级别16,状态12,第1行程序集“nationalinstruments.visans,版本=9.0.40.156,区域性=中性,publickeytoken=dc6ad606294fc298”。未在SQL
NationalInstruments.Common.Native.dll
尝试发布存储过程时,出现以下错误:
SQL72014:.Net SqlClient数据提供程序:Msg 6503,级别16,状态12,第1行程序集“nationalinstruments.visans,版本=9.0.40.156,区域性=中性,publickeytoken=dc6ad606294fc298”。未在SQL目录中找到
我尝试使用CREATE assembly with PERMISSION\u SET=UNSAFE
和trustry ON
将程序集添加到数据库中。在将System.Messaging
添加到数据库时,这对我来说很有效。当对NationalInstruments.Common.Native.dll执行相同操作时,我得到以下错误:
Msg 6544,第16级,状态1,第2行
为程序集“NationalInstruments.Common.Native”创建程序集失败,因为程序集“NationalInstruments.Common.Native”格式不正确或不是纯.NET程序集。
无法验证的PE头/本机存根
我知道SQLCLR不支持以本机(非托管代码)编写的程序集。但是,我确实需要NationalInstruments.Common.Native.dll
,因为它被NationalInstruments.Common.dll
引用,后者又被NationalInstruments.VisaNS
引用,这对我的存储过程的功能至关重要
有没有办法绕过使用NationalInstruments.Common.Native.dll
,或者以某种方式将其转换为托管代码的纯.NET程序集
(我不知道这是否相关,但存储过程是用C语言编写的,针对.NET Framework 4.5,使用Visual Studio 2012。)我没有答案,但it链接表明可能有方法将非托管代码加载到SQL Server中,但这绝对不是一个好主意。不幸的是,由于您无法控制DLL,因此您的选项有限。我该如何为DLL编写包装器?