2016-09-28 3 views
2

다른 사람이이 문제에 부딪히는 경우.어셈블리를 확인하지 못했기 때문에 SQLCLR 어셈블리 배포가 실패했습니다.

Error: SQL72014: .Net SqlClient Data Provider: ... CREATE ASSEMBLY for assembly 'Assembly.Name' failed because assembly 'Assembly.Name' 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
[token 0x02000003] Type load failed.

SQLCLR 어셈블리가 성공적으로 빌드되지만 배포 할 수 없습니다. 어셈블리가 일반 .NET 응용 프로그램 (SQL 서버의 외부)에 의해 액세스 될 때, 그것은 TypeLoadException을 줄 것이다 :

Could not load type 'Type.In.Assembly' from assembly 'Assembly.Name, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because the format is invalid.

문제는 어셈블리 내에서 사용자 정의 형 (UDT) 관련이있다.

+0

이 정보를 게시 주셔서 감사합니다 :) –

답변

2

우리가
[Microsoft.SqlServer.Server.SqlUserDefinedType(Format.Native)] 를 사용하여 UDT를 정의 할 때 범인은

System.Runtime.InteropServices.StructLayoutAttribute

하고 UDT는 또한 클래스에 [StructLayout(LayoutKind.Sequential)]을 정의하는 데 필요합니다 (대신 구조체의) 클래스입니다.

문제는 내 UDT 클래스가 기본 클래스에서 상속되었습니다. StructLayout도 기본 클래스에 정의해야합니다.

관련 문제