Dotfuscator User's Guide
Friend Assemblies

The .NET Framework has the concept of friend assemblies, where an assembly may declare that its internal type definitions are visible to specified other assemblies. This is done using the System.Runtime.CompilerServices.InternalsVisibleToAttribute. Dotfuscator detects the use of this attribute and modifies its renaming and pruning rules as described below.

Assume A and B are two assemblies where assembly B references A, and A is marked with InternalsVisibleTo ( B ).

There are a few cases of interest:

  1. A and B are both input assemblies and Dotfuscator is in library mode. If A has no other external, non-input assembly friends, Dotfuscator safely mangles internal names and fixes up the references in assembly B. If A does have other external friends, then internal names are preserved.
  2. A and B are both input assemblies and Dotfuscator is not in library mode. Internal names in A are, by default, mangled and references in B are fixed up, regardless of the existence of other external friend assemblies. As usual in Dotfuscator, names and groups of names can be preserved via manual configuration.
  3. A is an input assembly, B is not, and Dotfuscator is in library mode. Internal names in A are not mangled in order to not break potential references in B.
  4. A is an input assembly, B is not, and Dotfuscator is not in library mode. Internal names are mangled, potential references in B are not fixed up since it is not an input assembly. As usual in Dotfuscator, names and groups of names can be preserved via manual configuration. This case would require manual configuration if B actually does reference A’s internals.

 

 


© 2016 PreEmptive Solutions, LLC. All Rights Reserved.

www.preemptive.com