Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild and <AutoUnifyAssemblyReferences />

Tags:

c#

msbuild

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?

like image 778
Ruslan Dayanov Avatar asked Dec 02 '15 11:12

Ruslan Dayanov


1 Answers

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

like image 189
Christian.K Avatar answered Oct 06 '22 23:10

Christian.K