MSBuild.ILMerge.Task not allowing Duplicate Types

2019-09-14 07:09发布

问题:

I'm getting the following error from a call to ILMerge.

ILMerge.Merge: ERROR!!: Duplicate type 'System.Net.Http.HttpRequestMessageExtensions' found in assembly 'System.Net.Http.Formatting'. Do you want to use the /alllowDup option?

And you'd think this would be straightforward to solve. The error message says what to do.

But my call to ILMerge is made by MSBuild.ILMerge.Task

And it seems I'm already doing what I need to do to get this to happen...

From my ILMerge.props file:

<!-- added in Version 1.0.4, default=none -->
<ILMergeAllowDuplicateType>true</ILMergeAllowDuplicateType>

` I'm getting warnings about validation of this properties file, but nothing else that would prevent the build. So what does it take to convey this to ILMerge?

回答1:

Per: https://ilmergemsbuild.codeplex.com/workitem/11

Seems the correct value is

<ILMergeAllowDuplicateType>*</ILMergeAllowDuplicateType>