首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么SQL-CLR代码只能正确安装在一个数据库上,而不能正确安装在同一个SQL Server的任何其他数据库上?

为什么SQL-CLR代码只能正确安装在一个数据库上,而不能正确安装在同一个SQL Server的任何其他数据库上?
EN

Stack Overflow用户
提问于 2013-06-17 15:05:53
回答 1查看 565关注 0票数 0

我已经从Visual Studio将相同的CLR数据库函数发布到Staging和Live db实例,它们都位于相同的MS SQL Server上,版本为11.0.2100.60。

它们都安装得很好,但是当我在Live上运行相同的函数时,我得到了以下错误消息:

代码语言:javascript
复制
Msg 6522, Level 16, State 1, Line 1
A .NET Framework error occurred during execution of user-defined routine or aggregate "RankWords": 
System.IO.FileLoadException: Could not load file or assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ---> System.IO.FileLoadException: The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
System.IO.FileLoadException: 

System.IO.FileLoadException: 
   at net.johnhenry.lib.search.SearchAndRankingHelper.RankWords(String original_text, String words_being_searched, Int32 min_search_words_length, Boolean is_default_behaviour_and, Boolean is_partial_match)
   at SqlClrExtension.UserDefinedFunctions.RankWords(String original_text, String words_being_searched, Int32 min_search_words_length, Boolean is_default_behaviour_and).

有什么建议吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-06-17 23:36:44

在花了一整天的时间搜索了这个主题最深奥的网站后,我终于解决了这个问题!:)

我一直在现有的程序集上重新发布,只是调整了一些设置,但这样做时,Visual Studio不会生成整个SQL脚本来安装CLR代码,而只是生成VS认为已更改的SQL脚本来安装CLR代码。

解决方案是删除程序集及其所有依赖项,然后重新发布!

Visual Studio的发布功能将生成安装代码所需的整个SQL脚本,这解决了我怀疑是错误注册的库的问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17142041

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档