Tuesday, June 9, 2020

ElasticSearch.NET exception after upgrade

After upgrading ElasticSearch.NET to the latest version, my application failed with the following error message:

Could not load type 'Elasticsearch.Net.IInternalSerializerWithFormatter' from assembly 'Elasticsearch.Net, Version=, Culture=neutral, PublicKeyToken=96c599bbe3e70f5d'.

A look at my packages.config (yes it is still an old(er) ASP.NET application), showed the following:

<package id="CommonServiceLocator" version="2.0.1" targetFramework="net461" requireReinstallation="true" />

<package id="Elasticsearch.Net" version="7.7.1" targetFramework="net472" />

<package id="Iesi.Collections" version="" targetFramework="net461" />

<package id="LazyCache" version="" targetFramework="net461" />

<package id="Microsoft.CSharp" version="4.6.0" targetFramework="net472" />

<package id="NEST" version="7.1.0" targetFramework="net472" />

The problem was that although I had updated the Elasticsearch.NET nuget packages I forgot to do the same thing for the NEST high level client.

To fix it I had to update the NEST nuget package as well.