0

My project is of type "Class library" and has a reference to "Newtonsoft.Json". I would like to have one single DLL as output so that other consumers only have to exchange one DLL. Right now, the project builds to two single DLLs.

I have set "Embed Interop Types" to "True" for "Newtonsoft.Json" which resulted in an error ("Cannot embed interop types because it is missing either the 'ImportedFromTypeLibAttribute' attribute or the 'PrimaryInteropAssemblyAttribute' attribute..").

I have also found many other posts regarding this problem, but most of these posts were about including DLLs in a .exe which I do not have.

How can I merge both DLLs?

peter
  • 2,103
  • 7
  • 25
  • 51
  • 2
    Already answered here: http://stackoverflow.com/questions/1829531/how-do-i-merge-multiple-net-assemblies-into-a-single-assembly – Chris Mar 17 '16 at 15:32
  • There is an altenative to ILMerge: https://www.nuget.org/packages/ILRepack/ – xanatos Mar 17 '16 at 15:38
  • 1
    Just don't, whomever is going to use your library can get that DLL as well. If you merge it then you'll just give him a giant headache when he's got a project that uses it as well. It is too common. – Hans Passant Mar 17 '16 at 15:45

1 Answers1

0

Have you tried using an external tool like ILMerge (https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=17630) ?

user1385417
  • 131
  • 5