Search code examples
c#.netmsbuildstatic-linkingilmerge

MSBuild.ILMerge.Task not allowing Duplicate Types


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?


Solution

  • 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