Question

I've published from Visual Studio the same CLR database function to both the Staging and Live db instances, they both live on the same MS SQL Server which is version 11.0.2100.60.

They both install fine however when I run a same function on the Live, I get the following error message:

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).

Any advice?

Was it helpful?

Solution

I eventually managed to solve the problem after having spent the entire day searching the most esoteric sites on the topic! :)

I kept republishing on top of the existing Assembly, just tweaking little bits of the settings but when doing this Visual Studio does not generate the entire SQL script to install the CLR code like if a fresh install but only the SQL script for what VS thinks it has changed.

The solution has been to drop the assembly and all its dependencies and republish afresh!

Visual Studio's Publish function will generate the entire SQL script needed to install the CLR code which resolved what I suspect was a badly registered library.

.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top