这是方案
A.dll
引用B.dll (2.0.0.0)
A.dll
引用C.dll
和C.dll
引用B.dll (1.0.0.0)
显然,msbuild
会在B.dll
版本发生冲突时调用下面的警告。由于我拒绝在csproj文件中自动创建app.config
文件,它会自动选择最新版本。
Warning: MSB3276 - Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects"
我不希望重定向任何内容,因为任何人都无法使用其他版本。
问题:
如何摆脱此警告或禁止?
注意:两个程序集都将在安装过程中安装在GAC中,因此运行时引用将解决得很好。可悲的是,似乎没有办法表明MSBuild
放弃这个警告。
答案 0 :(得分:0)
如何摆脱此警告或禁止它?
这是一个非常顽固的警告,但这是一个有效的警告。您可以尝试编辑项目文件并添加此属性组并设置为禁用警告:
<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
注意:此设置还包括有关不匹配程序集等的其他警告.MSB3270。
答案 1 :(得分:0)
从Visual Studio 2017 / MSBuild 15开始,编辑项目文件,并将以下内容添加到Project\ProprtyGroup
部分:
<PropertyGroup>
<MSBuildWarningsAsMessages>MSB3276</MSBuildWarningsAsMessages>
</PropertyGroup>
在我的Visual Studio 15.9.11实例上工作
里奇