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, 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

nuget install Lucene.Net -Version

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=, 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:

      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <assemblyIdentity name="Lucene.Net" publicKeyToken="d846ee227f01c7a1"/>
          <bindingRedirect oldVersion="" newVersion=""/>

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