Creating NationalInstruments.Common.Native.dll in SQL Server
-
11-12-2021 - |
Question
I've written a stored procedure to be deployed to a SQL Server 2012 database. The stored procedure as written references a number of assemblies, including NationalInstruments.Common.Native.dll
.
When I try to publish the stored procedure, I get the following error:
SQL72014: .Net SqlClient Data Provider: Msg 6503, Level 16, State 12, Line 1 Assembly 'nationalinstruments.visans, version=9.0.40.156, culture=neutral, publickeytoken=dc6ad606294fc298.' was not found in the SQL catalog.
I tried adding the assembly to the database using CREATE ASSEMBLY with PERMISSION_SET=UNSAFE
and TRUSTWORTHY ON
. This has worked for me before, when adding System.Messaging
to the database. When doing the same for NationalInstruments.Common.Native.dll
, I get the following error:
Msg 6544, Level 16, State 1, Line 2
CREATE ASSEMBLY for assembly 'NationalInstruments.Common.Native' failed because assembly 'NationalInstruments.Common.Native' is malformed or not a pure .NET assembly. Unverifiable PE Header/native stub.
I understand that SQLCLR does not support assemblies written in native (unmanaged code). However, I really need NationalInstruments.Common.Native.dll
, as it is referenced by NationalInstruments.Common.dll
, which is in turn referenced by NationalInstruments.VisaNS
, which is essential to the functionality of my stored procedure.
Is there any way to get around using NationalInstruments.Common.Native.dll
, or to somehow convert it to a pure .NET assembly of managed code?
(I don't know if this is relevant, but the stored procedure is written in C# targeted to the .NET Framework 4.5, using Visual Studio 2012.)
No correct solution