Combining assemblies and using an internal keyword

Does assembly merge combine the volume of the internal keyword?

I am pretty sure that this will not affect (or at least one that matters), since anyone who references the final assembly will still not be able to access the inner classes.

This may be a hypothetical question without real world value, but I was curious.

Edit: I mean ILMerge, not combining the source code into a single assembly.

+7
source share
3 answers

Yes, when assemblies are combined, they gain access to each other's inner classes. This is due to some obfuscators to make public calls between assemblies into internal calls, and then mask them, making them more secure. Link: SmartAssembly

On the side of the note, using ILMerge, you can use the / internalize command line switch, which will make all public classes in assemblies other than the primary assembly internal, which removes the public interfaces from the eyes of the end user, but still the assembly function is in normal mode.

+10
source

Assuming you are not working with full trust, any types that were combined into a final assembly with internal types will now be able to access public members of internal types.

So this assembly A:

public class MyClassA { ... } 

and assembly B:

 internal class MyClassB { ... } 

MyClassA may not have permission to display public users of MyClassB. If they were merged into the same assembly, MyClassA can get this permission.

+3
source

Another possible resource for more information: Microsoft ILMerge Research Page , where they offer an alternative to ILMerge

+1
source

All Articles