MSBuild and <AutoUnifyAssemblyReferences />

半世苍凉 提交于 2020-01-13 02:43:14

问题


The "Microsoft.Bcl.Build.targets" contains this block:

    <!-- 
  Workaround MSBuild issue that prevents System.Runtime 2.5 and System.Threading.Tasks 2.5 from
  satisfying indirect dependencies on System.Runtime 1.5 and System.Threading.Tasks 1.5 respectively.  
-->
<AutoUnifyAssemblyReferences>false</AutoUnifyAssemblyReferences>

What actually "AutoUnifyAssemblyReferences" do?


回答1:


It maps directly to the AutoUnify parameter of the ResolveAssemblyReferencs-Task.

Excerpt from the documentation:

This parameter is used for building assemblies, such as DLLs, which cannot have a normal App.Config file.

When true, the resulting dependency graph is automatically treated as if there were anApp.Config file passed in to the AppConfigFile parameter.This virtual App.Config file has a bindingRedirect entry for each conflicting set of assemblies such that the highest version assembly is chosen.A consequence of this is that there will never be a warning about conflicting assemblies because every conflict will have been resolved.

When true, each distinct remapping will result in a high priority comment showing the old and new versions and that AutoUnify was true.

When true, the AppConfigFile parameter must be empty

When false, no assembly version remapping will occur automatically.When two versions of an assembly are present, a warning is issued.

When false, each distinct conflict between different versions of the same assembly results in a high-priority comment.These comments are followed by a single warning.The warning has a unique error code and contains text that reads "Found conflicts between different versions of reference and dependent assemblies".

The highlighted sentence seems to explain the comment in Microsoft.Bcl.Build.Targets you refer to.

(This parameter also influences the not uncommon MSB3247 warning.)

The defaults for the AutoUnifyAssemblyReferences is therefor set to false for certain types of "exe" assemblies and to true for other assembly types (see %Windir%\Microsoft.NET\Framework64\v4.0*\Microsoft.Common.Targets for details).



来源:https://stackoverflow.com/questions/34042189/msbuild-and-autounifyassemblyreferences

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!