title: ILMerge.Merge: ERROR!!: Duplicate type found in assembly
body: <p>I'll make this as simple as I can, if you need any more info please let me know. I downloaded <a href="http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx">ILMerge</a> to merge <a href="http://james.newtonking.com/json">Newtonsoft.Json.dll</a> into my class library. I am invoking ILMerge from the post-build event command line with the following:</p>
  
  <pre><code>"$(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
  </code></pre>
  
  <p>In the output window it says:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>The problem is that 'myLibrary.some.class' is NOT a duplicate.</p>
  
  <p>I've been all over the internet looking for clues and all I've turned up is the following 2 links, and a few cases of web apps where people have copy/pasted pages and forgot to change the class names.</p>
  
  <p><a href="http://dreamlusion.wordpress.com/2008/07/06/an-error-occurred-when-merging-assemblies-access-to-the-path-is-denied/">similar problem with a solution that doesn't seem relevant</a></p>
  
  <p><a href="http://www.codeproject.com/Questions/453084/Using-ilmerge-on-a-csharp-class-library-to-create">same cry for help but with no answers</a></p>
  
  <p>I've tried using the allowDup option but in the merged dll it turns 'myLibrary.some.class' into 'myLibrary.some.random125624.class'. Then I tried using 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!</p>
  
  <p>I'm certain these classes are not duplicates as the namespace is very specific to my company and project.</p>
  
  <p>Can anyone help?</p>