如何非常手术和特别抑制MSB3277警告我们想要允许的一个冲突?

时间:2016-05-10 19:28:15

标签: c# msbuild suppress-warnings

我们有软件允许用户在运行时选择他们希望与哪个版本的Microsoft Great Plains软件集成,因此,我们需要使用哪个版本的Microsoft Econnect DLL来集成它们。我们的代码进行了大量的运行时调查,并根据需要切换和加载适当的DLL。

但是,我们必须在我们的解决方案中包含所有DLL,以便它们在运行时可用,并且在解决方案中包含所有这些DLL会导致MSB3277警告,即:

  

警告MSB3277:发现无法解析的相同从属程序集的不同版本之间发生冲突。当日志详细程度设置为详细信息时,这些引用冲突将在构建日志中列出。

查看在诊断模式下生成的日志文件时,相关行如下:

29>  There was a conflict between "Microsoft.Dynamics.GP.eConnect, Version=10.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "Microsoft.Dynamics.GP.eConnect, Version=11.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
29>      "Microsoft.Dynamics.GP.eConnect, Version=10.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was chosen because it was primary and "Microsoft.Dynamics.GP.eConnect, Version=11.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was not.
29>      References which depend on "Microsoft.Dynamics.GP.eConnect, Version=10.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [C:\Development\Main\Tools\bin\GP10\Microsoft.Dynamics.GP.eConnect.10.dll].
29>          C:\Development\Main\Tools\bin\GP10\Microsoft.Dynamics.GP.eConnect.10.dll
29>            Project file item includes which caused reference "C:\Development\Main\Tools\bin\GP10\Microsoft.Dynamics.GP.eConnect.10.dll".
29>              Microsoft.Dynamics.GP.eConnect.10
29>      References which depend on "Microsoft.Dynamics.GP.eConnect, Version=11.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [].
29>          C:\Development\Main\Client\IntegrationModule\bin\Debug\GreatPlains2010Interface.dll
29>            Project file item includes which caused reference "C:\Development\Main\Client\IntegrationModule\bin\Debug\GreatPlains2010Interface.dll".
29>              C:\Development\Main\Client\IntegrationModule\bin\Debug\IntegrationModule.dll
29>          C:\Development\Main\Client\IntegrationModule\bin\Debug\GreatPlainsInterface.dll
29>            Project file item includes which caused reference "C:\Development\Main\Client\IntegrationModule\bin\Debug\GreatPlainsInterface.dll".
29>              C:\Development\Main\Client\IntegrationModule\bin\Debug\IntegrationModule.dll
29>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.

我想仅限制此冲突的警告,因为我们在运行时自行解决,但允许可能出现的任何其他冲突(目前没有)发出此警告。

有没有办法做到这一点?

或者,理解绑定重定向的人是否可以比我建议的方式更好地避免警告?

提前致谢。

1 个答案:

答案 0 :(得分:2)

多年前我遇到了类似的问题;我发现解决问题的唯一方法是使用post-build命令将所需的DLL从已知位置复制到bin \ location。 不过,这些天可能有更好的答案。