Search code examples
c#asp.netdllclass-library

How to call merged dll


I have merged two dll a.dll and b.dll into one (merged.dll), now i want to use this dll in my project by typing using merged.dll;, also have pass the reference but it is giving me an error that

type or namespace merged could not be found(...)

I know I can add the reference of merged.dll in the project and use a.dll and b.dll separately but i want to add merged.dll and use all the methods and classes of a and b without calling them like using a.dll; and using b.dll; and I have also check the .net framework version of my project and the merged dll both are same, and I am using visual studio IDE.

And I have used ILMerge to merge the dll's.

kindly suggest me the solutions how can I fix this.

Best Regards,


Solution

  • ILMerge does not change namespaces, it will do repackaging of existing code into a single assembly file. So using Merged; will not work.

    Solution 1)You would need to use the original namespaces from the unmerged using A; using B;

    or 2) Using Aliases as you shared