SQL Server 2016: CREATE ASSEMBLY for assembly 'System.ServiceModel' failed

家住魔仙堡 提交于 2019-12-11 04:15:30

问题


I am trying to import System.ServiceModel.dll for one of my projects in getting the following:

CREATE ASSEMBLY for assembly 'System.ServiceModel' failed because assembly 'microsoft.visualbasic.activities.compiler' is malformed or not a pure .NET assembly.

SQL Server is running on Windows Server 2012 R2.

Is there a fix for this issue?

I am aware of similar issues with SQL Server 2012? How about SQL Server 2014?

Thanks in advance


回答1:


No, there is no fix that will allow for loading ServiceModel. The problem is that it is an unsupported .NET Framework library. This library did work in SQL Server 2005, 2008, and 2008 R2 as they were linked to CLR version 2.0. However, since it is not in the "supported" list, it was never guaranteed to work across all .NET Framework upgrades. Hence, while it used to be a pure-MSIL Assembly, they changed it to be a mixed-mode Assembly, and those cannot be loaded into SQL Server, starting with SQL Server 2012.

This issue has been documented on Stack Overflow here:

  • Register CLR function (WCF based) in SQL Server 2012

  • SQL CLR - Migration from 2008 R2 to 2012.

  • (Unfixable) Assembly exists on SQL Server 2014 but it claims it doesn't have it

More info here:

  • SQL Server: "CREATE ASSEMBLY for assembly 'Test' failed because assembly 'Test' is malformed or not a pure .NET assembly."

  • SQL Server custom CLR fails with error "Could not load file or assembly or one of its dependencies. The system cannot find the file specified."



来源:https://stackoverflow.com/questions/40349838/sql-server-2016-create-assembly-for-assembly-system-servicemodel-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!