Lei Wu, Web Developer

Keeping simple things simple.

Failed Attempt to Upgrade Lucene.Net for Kentico 7

A web site I’m working on uses Kentico CMS version 7. Occasionally its search function would break down due to a corrupted Lucene index.

Kentico CMS’s SmartSearch is built on top of Lucene.Net. Kentico 7 comes with Lucene.Net 2.1.0.3, a very old version. One of the things I tried was to upgrade Lucene.Net.

Although the latest version is 3.0.3, I decided to go with 2.9.4.1.

nuget install Lucene.Net -Version 2.9.4.1

Then I replaced Kentico’s Lucene.Net.dll and dependency ICSharpCode.SharpZipLib.dll.

As expected, Kentico throws an error “Could not load file or assembly ‘Lucene.Net, Version=2.1.0.3, Culture=neutral, PublicKeyToken=d846ee227f01c7a1’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference.”

Trying to work around it, I added the following to web.config:

1
2
3
4
5
6
7
8
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
          <assemblyIdentity name="Lucene.Net" publicKeyToken="d846ee227f01c7a1"/>
          <bindingRedirect oldVersion="2.1.0.3" newVersion="2.9.4.1"/>
      </dependentAssembly>
      </assemblyBinding>
   </runtime>

Unfortunately, it didn’t help. A closer look at the error message shows the exception was thrown by CMS.LicenseProvider.LicenseHelper.