(Неисправимо) Сборка существует в SQL Server 2014, но утверждает, что ее нет
Обновление: эта проблема не устранена: https://connect.microsoft.com/SQLServer/Feedback/Details/809697
Я пытаюсь создать сборку SQL CLR с помощью.net 4.5, и она говорит мне, что она отсутствует system.servicemodel
(даже если он находится в папках сборки.net):
Assembly 'MySQLCLRProject' references assembly 'system.servicemodel, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.
Поэтому я вручную добавляю 4.5,4.5.1,4.5.2 System.ServiceModel.dll
в папку проекта, то он говорит мне, что он отсутствует system.servicemodel.internals
:
Warning: The Microsoft .NET Framework assembly 'system.servicemodel, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.' you are registering is not fully tested in the SQL Server hosted environment and is not supported. In the future, if you upgrade or service this assembly or the .NET Framework, your CLR integration routine may stop working. Please refer SQL Server Books Online for more details.
Msg 10301, Level 16, State 1, Line 13
Assembly 'MySQLCLRProject' references assembly 'system.servicemodel.internals, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.
Поэтому я добавляю 4.6 System.ServiceModel.dll
это скажет мне, что это отсутствует system.xaml
:
Warning: The Microsoft .NET Framework assembly 'system.servicemodel, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.' you are registering is not fully tested in the SQL Server hosted environment and is not supported. In the future, if you upgrade or service this assembly or the .NET Framework, your CLR integration routine may stop working. Please refer SQL Server Books Online for more details.
Msg 10301, Level 16, State 1, Line 13
Assembly 'MySQLCLRProject' references assembly 'system.xaml, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.
После того, как я добавляю system.xaml (4.5-4.6.1), он говорит мне следующее:
Warning: The Microsoft .NET Framework assembly 'system.servicemodel, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.' you are registering is not fully tested in the SQL Server hosted environment and is not supported. In the future, if you upgrade or service this assembly or the .NET Framework, your CLR integration routine may stop working. Please refer SQL Server Books Online for more details.
Warning: The Microsoft .NET Framework assembly 'system.xaml, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.' you are registering is not fully tested in the SQL Server hosted environment and is not supported. In the future, if you upgrade or service this assembly or the .NET Framework, your CLR integration routine may stop working. Please refer SQL Server Books Online for more details.
Msg 6218, Level 16, State 2, Line 13
CREATE ASSEMBLY for assembly 'MySQLCLRProject' failed because assembly 'System.Xaml' 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
[ : System.Xaml.AttachableMemberIdentifier::ToString][mdToken=0x6000009][offset 0x00000000] Code size is zero.
[ : System.Xaml.AttachableMemberIdentifier::Equals][mdToken=0x6000006][offset 0x00000000] Code size is zero.
[ : System.Xaml.AttachableMemberIdentifier::GetHashCode][mdToken=0x6000008][offset 0x00000000] Code size is zero.
[ : System.Xaml.AttachableMemberIdentifier::Equals][mdToken=0x6000007][offset 0x00000000] Code size is zero.
[ : System.Xaml.AttachableMemberIdentifier::.ctor][mdToken=0x6000001][offset 0x00000000] Code size is zero.
[ : System.Xaml.AttachableMemberIdentifier::get_MemberName][mdToken=0x6000002][offset 0x00000000] Code size is zero.
[ : System.Xaml.AttachableMemberIdentifier::get_DeclaringType][mdToken=0x6000003][offset 0x00000000] Code size is zero.
[ : System.Xaml.AttachableMemberIdentifier::op_Inequality][mdToken=0x6000004][offset 0x00000000] Code size is zero.
[ : System.Xaml.AttachableMemberIdentifier::op_Equality][mdToken=0x6000005][offset 0x00000000] Code size is zero.
[ : System.Xaml.AttachablePropertyServices::.cctor][mdToken=0x6000010][offset 0x00000000] Code size is zero.
[ : System.Xaml.AttachablePropertyServices::TryGetProperty[T]][mdToken=0x600000f][offset 0x00000000] Code size is zero.
[ : System.Xaml.AttachablePropertyServices::GetAttachedPropertyCount][mdToken=0x600000a][offset 0x00000000] Code size is zero.
[ : System.Xaml.AttachablePropertyServices::CopyPropertiesTo][mdToken=0x600000b][offset 0x00000000] Code size is zero.
[ : System.Xaml.AttachablePropertyServices::RemoveProperty][mdToken=0x600000c][offset 0x00000000] Code size is zero.
[ : System.Xaml.AttachablePropertyServices::SetProperty][mdToken=0x600000d][offset 0x00000000] Code size is zero.
[ : System.Xaml....
Я искал по всему и не мог найти ничего, чтобы решить эту проблему. Я даже полностью воссоздал проект с.net 4.5, и он все еще доставляет мне проблемы.
Любая помощь приветствуется, спасибо!
1 ответ
Проблема в том, что вы пытаетесь использовать неподдерживаемую библиотеку.NET Framework: ServiceModel
, Эта библиотека работала в SQL Server 2005, 2008 и 2008 R2. Однако, поскольку он отсутствует в списке "поддерживаемых", он не гарантированно работает во всех обновлениях.NET Framework. Раньше это была сборка с чистым MSIL, но затем они изменили ее на сборку смешанного режима, и они не могут быть загружены в SQL Server.
Эта проблема была задокументирована по переполнению стека здесь:
Больше информации здесь: