如何抑制“发现不同版本之间的冲突"警告? [英] How to suppress 'Found conflicts between different versions of' warning?

查看:135
本文介绍了如何抑制“发现不同版本之间的冲突"警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个项目中,我具有以下参考布局:

In a project I have the following reference layout:

References
+- AssemblyA 6.7.6643.0
+- AssemblyB
|  \- AssemblyA 7.0.0.0
\- AssemblyC
   \- AssemblyA 7.0.0.0

AssemblyB和AssemblyC是没有降级的NuGet引用.由于我无法控制的情况,无法升级AssemblyA.但是我得到这个警告:

AssemblyB and AssemblyC are NuGet references for which there is no downgrade. Due to circumstances outside of my control, upgrading AssemblyA is not an option. But I get this warning:

发现不同版本的"AssemblyA"之间存在冲突,这可能 无法解决.这些参考冲突在构建中列出 将日志详细程度设置为详细"时记录日志.

Found conflicts between different versions of "AssemblyA" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.

所以我做到了,这就是输出:

So I did just that and this is the output:

"AssemblyA,版本= 6.7.6643.0"与 "AssemblyA,版本= 7.0.0.0". 选择了"AssemblyA,版本= 6.7.6643.0",因为它是主要版本,而不是"AssemblyA,版本= 7.0.0.0". 依赖于"AssemblyA,版本= 6.7.6643.0" [AssemblyA.dll]的引用. AssemblyA.dll 项目文件项包括引起引用"AssemblyA.dll"的文件. AssemblyA,版本= 6.7.6643.0 依赖于"AssemblyA,版本= 7.0.0.0" []的引用. AssemblyB.dll 项目文件项包括引起引用"AssemblyB.dll"的文件. AssemblyB,版本= 7.0.0.0 AssemblyC.dll 项目文件项包括引起引用"AssemblyC.dll"的文件. AssemblyC,版本= 9.0.0.0

There was a conflict between "AssemblyA, Version=6.7.6643.0" and "AssemblyA, Version=7.0.0.0". "AssemblyA, Version=6.7.6643.0" was chosen because it was primary and "AssemblyA, Version=7.0.0.0" was not. References which depend on "AssemblyA, Version=6.7.6643.0" [AssemblyA.dll]. AssemblyA.dll Project file item includes which caused reference "AssemblyA.dll". AssemblyA, Version=6.7.6643.0 References which depend on "AssemblyA, Version=7.0.0.0" []. AssemblyB.dll Project file item includes which caused reference "AssemblyB.dll". AssemblyB, Version=7.0.0.0 AssemblyC.dll Project file item includes which caused reference "AssemblyC.dll". AssemblyC, Version=9.0.0.0

它选择了我想要的版本,但是在Visual Studio中我仍然收到警告.因此,我更新了app.config绑定重定向,希望它能摆脱警告:

It chose the version I wanted it to, but I still get a warning in Visual Studio. So I updated the app.config binding redirect in the hopes it would get rid of the warning:

<dependentAssembly>
  <assemblyIdentity name="AssemblyA" publicKeyToken="..." culture="neutral" />
  <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="6.7.6643.0" />
</dependentAssembly>

但是警告仍然存在.我已经确认,如果我将AssemblyA升级到7.0.0.0,它将导致警告消失.但是正如我之前所说,由于其他无法控制的原因,我现在无法升级此程序集.

But the warning persists. I have confirmed that if I upgrade AssemblyA to 7.0.0.0 it causes the warning to go away. But as I said earlier, for other reasons outside of my control I cannot upgrade this assembly right now.

反正有只针对这个特定实例的警告吗?

Is there anyway to suppress this warning just for this one particular instance?

谢谢

推荐答案

1.此警告似乎在编译器编译项目时发生,它将对使用哪个版本的.dll感到困惑,从而抛出MSB3277.警告.通常,我们可以通过升级旧版本或降级新版本来解决此警告.但是在这种情况下,似乎没有解决此警告的有效方法.

1.This warning seems to occur when the compiler compile the project, it will be confused about which version of the .dll to use so that it throws the MSB3277 warning. Usually, we can solve this warning by upgrading your old version or downgrading new version. But in this situation, it seems no valid way to resolve this warning.

2.此外,有时我们可以通过设置一些属性来抑制警告,但这似乎不适用于MSB警告,因为带有MSB前缀的警告由MSBuild抛出,并且目前没有有效的方法来抑制MSB警告.

2.What’s more, sometimes we can suppress the warning by setting some property, but that seems not work for MSB warnings because Warnings with MSB prefix are thrown by MSBuild and there has no valid way to suppress MSB warning currently.

特别是对于MSB3277,我通过nowarn,#pargma,proj中的属性对vs2017进行了测试,但是不幸的是,它不起作用. 我们可以在此处找到类似的问题:如何隐藏特定的MSBuild警告 禁止MSB4126

Especially for MSB3277, I test with vs2017 by nowarn, #pargma, property in proj but unfortunately,it do not work. We can find similar issues here: How to suppress specific MSBuild warning Suppress MSB4126

因此,恐怕我们目前没有有效的方法来抑制MSB3277.很抱歉给您带来不便.

So, I am afraid we have no valid way to suppress MSB3277 currently. Sorry about this inconvenience.

这篇关于如何抑制“发现不同版本之间的冲突"警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆