I will make it as simple as possible, if you need more information, please let me know. I downloaded ILMerge to combine Newtonsoft.Json.dll into my class library. I call ILMerge from the command line events after the build with the following:
"$(ProjectDir)bin\ILMerge.exe" /internalize:"$(ProjectDir)bin\ILMergeIncludes.txt" /out:"$(TargetDir)$(TargetName).all.dll" "$(TargetDir)$(TargetName).dll" "$(TargetDir)*.dll" /target:library /targetplatform:v4,C:\Windows\Microsoft.NET\Framework64\v4.0.30319 /wildcards
The output window says:
An exception occurred during merging: ILMerge.Merge: ERROR!!: Duplicate type 'myLibrary.some.class' found in assembly 'myLibrary.all'. Do you want to use the /alllowDup option? at ILMerging.ILMerge.MergeInAssembly(AssemblyNode a, Boolean makeNonPublic, Boolean targetAssemblyIsComVisible) at ILMerging.ILMerge.Merge() at ILMerging.ILMerge.Main(String[] args)
The problem is that "myLibrary.some.class" is not a duplicate.
I searched around the internet for clues, and all I found was the following 2 links and several cases of web applications in which people copied / pasted pages and forgot to change class names.
similar problem with a solution that does not seem relevant
same cry for help but no answers
I tried using the allowDup parameter, but in the combined dll, it turned 'myLibrary.some.class' into 'myLibrary.some.random125624.class'. Then I tried to use allowDup, passing in 'class', but then I get "Duplicate type" errors for "class2" and then "class3" and then "class4" ... there seems to be no end to the number of duplicate types!
I am sure that these classes are not duplicates, as the namespace is very specific to my company and project.
Can anyone help?
source share