如何非常外科地和具体地抑制 MSB3277 警告,只针对我们想要允许的一个冲突?

How to very surgically and specifically suppress MSB3277 warning for only one conflict which we want to allow?

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

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

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.

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

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

我只想取消针对此冲突的警告,因为我们会在运行时自行解决它,但允许可能出现的任何其他冲突(当前 none)发出此警告。

有什么办法吗?

或者,比我更了解绑定重定向的人可以建议一种我们可以首先避免警告的方法吗?

提前致谢。

几年前我遇到过类似的问题;解决它的唯一方法(我发现)是使用 post-build 命令,该命令将所需的 DLL 从已知位置复制到您的 bin\ 位置。 不过,现在可能有更好的答案。