Thursday, March 29, 2012

Error registering a Third Party assembly

Help.

When I try to CREATE/Register a third party assembly (dtsearchNetApi2) within SQL server I am getting an error (see below). I have the source code for dtsearchNetApi2 but it is in C++ and I would like to avoid having to extend/modify it if that is avoidable. I have written a 'wrapper' class in C# but sine it references dtsearchNetApi2.dll I can't register that dll either.

CREATE ASSEMBLY DBSEARCHNETAPI

FROM 'C:\Temp\dtsearchNetApi2.dll'

WITH PERMISSION_SET = UNSAFE

Msg 6218, Level 16, State 3, Line 2

CREATE ASSEMBLY for assembly 'dtSearchNetApi2' failed because assembly 'dtSearchNetApi2' failed verification. Check if the referenced assemblies are up-to-date and trusted (for external_access or unsafe) to execute in the database. CLR Verifier error messages if any will follow this message

dtsearchNetApi2 has references to unmanaged code. The dtSearchNetApi2.dll is a .NET 2.0 wrapper around C++ objects exported in dten600.dll. It is implemented in MSVC++ with Managed Extensions is implemented in C++/CLI 2.0.

You can't load an unmanaged assembly into Sql Server, which means you can't have a direct reference to it from your managed assembly either. To correctly access your unmanaged assembly from within Sql Clr, you need to use P/Invoke (through DllImport) instead.

Steven

|||

Thanks for the reply Steven.

Too bad the support folks in the SQL Server 2005 support group didn't know that would have saved me a few days. :)

Burke

sql

No comments:

Post a Comment