无法加载文件或程序集的Lucene。Net, Version=2.9.2.2,定位程序集的清单定义与程序集引用不匹配

时间:2022-02-08 05:35:22

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

我正在尝试实现NHibernate。在我的web应用程序中搜索,我完成了配置,并从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)

无法加载文件或程序集的Lucene。Net, Version=2.9.2.2, Culture=中立,PublicKeyToken=null'或它的一个依赖项。定位程序集的清单定义与程序集引用不匹配。(从HRESULT例外:0 x80131040)

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.

装配经理从:C:\Windows\ Microsoft.NET \ Framework \ v4.0.30319 \ clr。dll下运行可执行C:\Program Files (x86)\Common微软文件\ \ DevServer \ 10.0 \ WebDev.WebServer40共享。下面是详细的错误日志。

=== 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.

=== =预绑定状态信息=== LOG: DisplayName = Lucene。Net, Version=2.9.2.2, Culture=中立,PublicKeyToken=null(完全指定)日志:Appbase = file:/// /D:/SJ/Application/Solution/SJ。网页/日志:初始的PrivatePath = D:\SJ\应用程序解决方案\SJ。Web\bin调用程序集:NHibernate。搜索、Version = 2.0.2.4000文化=中立,都必须为空。=== = LOG:这个绑定在默认加载上下文中启动。日志:使用应用程序配置文件:D:\SJ\应用程序解决方案\SJ. web \web。配置日志:使用主机配置文件:日志:使用机器配置文件从C:\Windows\ Microsoft.NET \ Framework \ v4.0.30319 \ config \ machine.config。日志:此时没有应用到引用的策略(私有的、自定义的、部分的或基于位置的程序集绑定)。日志:尝试下载新的URL文件:///C:/用户/AppData/Local/Temp/临时ASP。网络文件/根/ 33 aeca0d / 35 fb23ff / Lucene.Net.DLL。日志:尝试下载新的URL文件:///C:/用户/AppData/Local/Temp/临时ASP。网络文件/根/ 33 aeca0d / 35 fb23ff /Lucene.Net/Lucene.Net.DLL。日志:尝试下载新的URL文件:///D:/SJ/应用/解决方案/SJ. web /bin/Lucene.Net.DLL。WRN:比较程序集名称会导致不匹配:PUBLIC KEY TOKEN ERR:未能完成程序集的设置(hr = 0x80131040)。调查终止。

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

出现这个错误的原因是什么,我如何修正这个错误?

1 个解决方案

#1


0  

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.

试着看看包裹里面。配置,您应该看到Lucene包和编译时要查找的版本。尝试从Nuget包管理器中删除该包,然后输入包。配置并检查它是否仍然指向某个版本。如果是这样,请删除该文件中的引用,然后再次安装您想要使用的版本。

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

谢谢你的回答很有帮助,我已经按照以下方式解决了我的问题,我把Lucene都去掉了。我从我的解决方案下载了lucene.net,我从https://nh悔过b.svn.sourceforge.net/svnroot/nh悔过书/ trunk/src/nhibernate . search手动添加了引用,现在可以工作了

#1


0  

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.

试着看看包裹里面。配置,您应该看到Lucene包和编译时要查找的版本。尝试从Nuget包管理器中删除该包,然后输入包。配置并检查它是否仍然指向某个版本。如果是这样,请删除该文件中的引用,然后再次安装您想要使用的版本。

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

谢谢你的回答很有帮助,我已经按照以下方式解决了我的问题,我把Lucene都去掉了。我从我的解决方案下载了lucene.net,我从https://nh悔过b.svn.sourceforge.net/svnroot/nh悔过书/ trunk/src/nhibernate . search手动添加了引用,现在可以工作了