1

出现以下构建错误。

错误 15 未知的构建错误,'无法加载文件或程序集'log4net,版本 = 1.2。11 .0, Culture=neutral, PublicKeyToken= 669e0ddf0bb1aa2a ' 或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。(来自 HRESULT 的异常:0x80131040)'

我不太明白发生了什么事。我尝试使用 GUI 作为参考,但没有帮助。已经为此花费了 1.5 小时,但问题仍然存在。

我现在直接进入项目文件,对 log4net 的唯一引用如下:

<Reference Include="log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\..\ExternalDlls\.NET 4.0\log4net.dll</HintPath>
</Reference>

我仍然收到此错误。为什么它甚至提到V1.2。11 ?

提前致谢

4

4 回答 4

3

好的,最终构建工作。

我经历了所有其他项目并做了Resharper - 删除未使用的引用操作。

完成后,项目开始构建。

于 2013-09-20T03:03:36.690 回答
1

您能否检查提到的 Path ....\ExternalDlls.NET 4.0\log4net.dll中实际存在的版本,并查看GAC中存在的版本。

删除 GAC 中的版本,从项目文件中删除以下引用并从ExternalDlls文件夹中再次添加

<Reference Include="log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\..\ExternalDlls\.NET 4.0\log4net.dll</HintPath>
</Reference>
于 2013-09-20T02:33:20.310 回答
1

If you are creating a nuget package that is referencing log4net make sure your nuspec file is specifying the correct version of log4net (this is the problem I ran into after log4net released the new build). And make sure that if you don't want the latest version of log4net you encapsulate your version with "[" and "]" so that it doesn't get the latest. See this.. http://docs.nuget.org/docs/reference/versioning#Specifying_Version_Ranges_in_.nuspec_Files

Hope this helps someone.

于 2013-09-23T22:42:32.013 回答
0

I am facing this issue today. To solve this problem I deleted log4net.dll file reference from Bin Folder through visual studio. and rebuild the website. It automatically picks up log4net dll. This solved problem. Reason for this issue was Reference bind through visual studio may not be upto date with the actual file version.

于 2015-08-13T02:44:54.613 回答