1

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?

JoeHz
  • 2,136
  • 1
  • 18
  • 29

1 Answers1

11

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

Seems the correct value is

<ILMergeAllowDuplicateType>*</ILMergeAllowDuplicateType>

EDIT:

Link above is broken. New source

https://github.com/dotnet/ILMerge/blob/master/ilmerge-manual.md#21-allowduplicatetype

JoeHz
  • 2,136
  • 1
  • 18
  • 29
  • 1
    Thanks, this saved me. Using an asterisk makes no sense it should be Boolean. – Andrew Schultz Jul 15 '21 at 02:13
  • I had thought so too, but apparently it's not a flag. It's meant to hold the type that is acceptable to have duplicates, . * means all duplicates are permissible. – JoeHz Apr 20 '23 at 00:58