(无法修复)程序集存在于 SQL Server 2014 上,但它声称没有它

2023-12-08

Update:这个问题无法修复:https://connect.microsoft.com/SQLServer/Feedback/Details/809697

我正在尝试使用 .net 4.5 创建 SQL CLR 程序集,但它告诉我它丢失了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.2System.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.6System.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 完全重新创建了该项目,但它仍然给我带来问题。

任何帮助表示赞赏,谢谢!


这里的问题是您正在尝试使用不受支持的 .NET Framework 库:ServiceModel。该库可以在 SQL Server 2005、2008 和 2008 R2 中运行。但是,由于它不在“支持”列表中,因此不能保证它适用于所有 .NET Framework 升级。它曾经是一个纯 MSIL 程序集,但后来他们将其更改为混合模式程序集,并且这些程序集无法加载到 SQL Server 中。

此问题已记录在 Stack Overflow 上:

  • 在SQL Server 2012中注册CLR函数(基于WCF)

  • SQL CLR - 从 2008 R2 迁移到 2012。

更多信息请点击这里:

  • SQL Server:“为程序集“测试”创建程序集失败,因为程序集“测试”格式错误或不是纯 .NET 程序集。”

  • SQL Server 自定义 CLR 失败,并显示错误“无法加载文件或程序集或其依赖项之一。系统找不到指定的文件。”

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

(无法修复)程序集存在于 SQL Server 2014 上,但它声称没有它 的相关文章

随机推荐