Problem Loading the Ninject Assembly

In this article

Symptoms

When installing the Coveo for Sitecore package or accessing your Sitecore instance, you might get the following error:

System.IO.FileLoadException: Could not load file or assembly 'Ninject' or one of its dependencies. The located assembly’s manifest definition doesn’t match the assembly reference. (Exception from HRESULT: 0x80131040)

Cause

This issue arises when you already have the Ninject library on your website. Upon installing the Coveo for Sitecore package, you will be prompted to overwrite your existing Ninject.dll file. If you choose to overwrite it, Ninject version 3.0.1.10 will be deployed instead of your current Ninject library, therefore resulting in incorrect version numbers in your C# project references.

Resolution

To fix this issue, follow these steps:

  1. Replace the Ninject.dll assembly in your website bin directory with the one referenced by your project.

  2. Using a text editor, open the web.config file and insert the following lines in the assemblyBinding XML element:

     <dependentAssembly>
       <assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
       <bindingRedirect oldVersion="0.0.0.0-3.2.2.0" newVersion="<YOUR_NINJECT_VERSION>" />
     </dependentAssembly>
  3. Re-install the Coveo for Sitecore package, but when prompted to overwrite the Ninject.dll file, choose No. For all the other assemblies, you should choose Yes.

    35455046
  4. Restart the Sitecore client and server when prompted.