Could not load file or assembly 'Lucene.Net, Version=2.9.2.2, The located assembly's manifest definition does not match the assembly reference

2.5k views Asked by At

I'm try to implement NHibernate.Search to my web application, i hvae done configurations and loaded packages to the the application from NuGet

But when I run the application it throws following error

Could not load file or assembly 'Lucene.Net, Version=2.9.2.2, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under executable C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\WebDev.WebServer40.exe --- A detailed error log follows.

=== Pre-bind state information === LOG: DisplayName = Lucene.Net, Version=2.9.2.2, Culture=neutral, PublicKeyToken=null (Fully-specified) LOG: Appbase = file:///D:/SJ/Application/Solution/SJ.Web/ LOG: Initial PrivatePath = D:\SJ\Application\Solution\SJ.Web\bin Calling assembly : NHibernate.Search, Version=2.0.2.4000, Culture=neutral, PublicKeyToken=null. === LOG: This bind starts in default load context. LOG: Using application configuration file: D:\SJ\Application\Solution\SJ.Web\web.config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///C:/Users/AppData/Local/Temp/Temporary ASP.NET Files/root/33aeca0d/35fb23ff/Lucene.Net.DLL. LOG: Attempting download of new URL file:///C:/Users/AppData/Local/Temp/Temporary ASP.NET Files/root/33aeca0d/35fb23ff/Lucene.Net/Lucene.Net.DLL. LOG: Attempting download of new URL file:///D:/SJ/Application/Solution/SJ.Web/bin/Lucene.Net.DLL. WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

what is the reason to this error and how can I fix this ?

1

There are 1 answers

1
Oscar Bralo On BEST ANSWER

I had some similar issue like this.

Try looking inside the packages.config and you should see the Lucene package and the version that is looking for when you compile. Try removing tha package from the Nuget Package Manager, and then, enter the packages.config and check if it's still pointing to some version. If it is the case, remove the reference inside this file, and then install again the version you want to use.

Then come here again and check if it's pointing the right version. I think that you can even change here the version in order to point to the right place.

I hope this helps

Thanks your answer is helpful, and I have fix my issue in following way, I removed all Lucene.Net from my solution and I have downloaded lucene.net from https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib/trunk/src/NHibernate.Search and added reference manually, Now it is working