Question

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.

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

I have seen ILMerge from Microsoft, but was unable to figure if it can do what I want. http://research.microsoft.com/~mbarnett/ILMerge.aspx

Was it helpful?

Solution 2

I know Xenocode can merge assemblies into one but I am not sure if it will internalize other non-primary assemblies.

I have found the /internalize switch in ILMerge that "internalize" all assemblies except the primary one. Pretty useful!

OTHER TIPS

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 here.

I suggest you look at the InternalsVisibleTo attribute on MSDN.

You can mark everything in all the assemblies (except the API assembly) as internal instead of public, then reshow them to just your API assembly.

Having done that, using ILMerge should give you a single assembly with just the API classes visible.

There are some issues with ILMerge, but I think if you add optimisations + merge + obfuscation you're likely to create a highly complex situation for little benefit.

Why not have just one assembly, and make only your API public?

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top