<p>I have a set of multiple assemblies (one assembly is to be used as an API and it depends on other assemblies). I would like to merge all assemblies into one single assembly but prevent all assemblies except the API one to be visible from the outside.</p>

<p>I will then obfuscate this assembly with Xenocode. From what I have seen, it is impossible to internalize assembly with Xenocode.</p>

<p>I have seen ILMerge from Microsoft, but was unable to figure if it can do what I want.
<a href="http://research.microsoft.com/~mbarnett/ILMerge.aspx" rel="nofollow noreferrer">http://research.microsoft.com/~mbarnett/ILMerge.aspx</a></p>

[{'answer_id': 28915, 'author': 'Vincent', 'author_id': 1508, 'author_profile': 'https://Stackoverflow.com/users/1508', 'pm_score': 2, 'selected': True, 'text': '<p>I know Xenocode can merge assemblies into one but I am not sure if it will internalize other non-primary assemblies.</p>\n\n<p>I have found the /internalize switch in ILMerge that "internalize" all assemblies except the primary one. Pretty useful!</p>\n'}, {'answer_id': 174729, 'author': 'John Chuckran', 'author_id': 25511, 'author_profile': 'https://Stackoverflow.com/users/25511', 'pm_score': 2, 'selected': False, 'text': '<p>I have used ILMerge from microsoft to internalize DLL\'s into a single assembled library. There is a useful GUI for using ILMerge called NuGenUnify. You can find it <a href="http://www.genetibase.com/cforce/nugenunify.php" rel="nofollow noreferrer">here</a>.</p>\n'}, {'answer_id': 177982, 'author': 'Ant', 'author_id': 11529, 'author_profile': 'https://Stackoverflow.com/users/11529', 'pm_score': 1, 'selected': False, 'text': '<p>I suggest you look at the <code>InternalsVisibleTo</code> attribute on <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx" rel="nofollow noreferrer" title="MSDN">MSDN</a>.</p>\n\n<p>You can mark everything in all the assemblies (except the API assembly) as <code>internal</code> instead of <code>public</code>, then reshow them to just your API assembly.</p>\n\n<p>Having done that, using ILMerge should give you a single assembly with just the API classes visible.</p>\n'}, {'answer_id': 178362, 'author': 'Keith', 'author_id': 905, 'author_profile': 'https://Stackoverflow.com/users/905', 'pm_score': 1, 'selected': False, 'text': '<p>There are some <a href="https://stackoverflow.com/questions/123506">issues with ILMerge</a>, but I think if you add optimisations + merge + obfuscation you\'re likely to create a highly complex situation for little benefit.</p>\n\n<p>Why not have just one assembly, and make only your API public?</p>\n\n<p>If you\'re always distributing them as a single assembly there\'s no reason not to just compile them as that. You\'ll get more benefit from compiler optimisations and it will be quicker to compile too.</p>\n'}]
['https://Stackoverflow.com/questions/26719', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1508/']