.net 警告 MSB3276 - 发现同一依赖程序集的不同版本之间存在冲突

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23552250/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 12:44:00  来源:igfitidea点击:

warning MSB3276 - Found conflicts between different versions of the same dependent assembly

.netmsbuildnuget

提问by Michal Rogozinski

My solution consists of multiple projects and compiles fine. I'm using nuget and one of the packages that I use is log4net.2.0.0. I've recently updated the package to log4net.2.0.3 and made sure that in each project that belongs to the solution, the reference is updated. Unfortunately I'm still getting the following warning during the compilation process:

我的解决方案由多个项目组成并且编译得很好。我正在使用 nuget,我使用的软件包之一是 log4net.2.0.0。我最近将包更新为 log4net.2.0.3,并确保在属于解决方案的每个项目中,参考都已更新。不幸的是,我在编译过程中仍然收到以下警告:

(ResolveAssemblyReferences target) -> C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targe ts(1635,5): warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190.

(ResolveAssemblyReferences 目标)-> C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targe ts(1635,5):警告 MSB3276:发现同一依赖程序集的不同版本之间存在冲突。请在项目文件中将“AutoGenerateBindingRedirects”属性设置为 true。有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=294190

or a more elaborate version of this warning when compiling with /verbosity:detailed

或使用 /verbosity:detailed 编译时此警告的更详细版本

Consider app.config remapping of assembly "log4net, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a" from Version "1.2.11.0" [] to Version "1.2.13.0" [Z:\xxx\packages\log4net.2.0.3\lib\net40-full\log4net.dll] to solve conflict and get rid of warning. C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190. [Z:\xxx\xxx\xxx\xxx.csproj]
AssemblyFoldersEx location: "{Registry:Software\Microsoft.NETFramework,v4.5,AssemblyFoldersEx}"

考虑从版本“1.2.11.0”[] 到版本“1.2.13.0”[Z:\xxx\packages\log4net.2.0.3\lib\ net40-full\log4net.dll] 来解决冲突并消除警告。C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5):警告 MSB3276:发现同一依赖程序集的不同版本之间存在冲突。请在项目文件中将“AutoGenerateBindingRedirects”属性设置为 true。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkId=294190。[Z:\xxx\xxx\xxx\xxx.csproj]
AssemblyFoldersEx 位置:“{Registry:Software\Microsoft.NETFramework,v4.5,AssemblyFoldersEx}”

I understand what it means, unfortunately I can't track down which project/library still references the old version of log4net. I understand that I can mask the warning just by simply remapping in app.config, but it seems like sweeping the problem under the rug rather than actually solving it properly.

我明白这意味着什么,不幸的是我无法追踪哪个项目/库仍然引用旧版本的 log4net。我知道我可以通过简单地在 app.config 中重新映射来掩盖警告,但这似乎是把问题扫到了地毯下,而不是真正正确地解决它。

What is the best way of tracking down where in my solution I have areference to the old version of log4net? I've tried all the obvious including searching through all the files for the version number. I also made sure that no other nupkgs have the dependencies set to this specific version of log4net.

跟踪我的解决方案中我引用旧版本 log4net 的最佳方法是什么?我已经尝试了所有显而易见的方法,包括在所有文件中搜索版本号。我还确保没有其他 nupkg 将依赖项设置为此特定版本的 log4net。

Any help would be much appreciated.

任何帮助将非常感激。

采纳答案by Michal Rogozinski

Thanks to my dad and https://github.com/mikehadlow/AsmSpyI managed to find that:

感谢我父亲和https://github.com/mikehadlow/AsmSpy我设法找到了:

Reference: log4net 1.2.11.0 by SuperSocket.SocketBase

参考:Log4net 1.2.11.0 by SuperSocket.SocketBase

Haha! Great handy tool!

哈哈!好用的工具!