Library Mode
In the context of Dotfuscator, a library is an assembly that is referenced from other components that are not specified as inputs in the same Dotfuscator config.
Library Mode is a per-assembly option that tells Dotfuscator not to rename or remove anything that could be accessed from outside that library assembly.
If Library Mode is not set for an input assembly, then it should be a standalone application or should only be referenced by other input assemblies. Renaming and Removal will be more aggressive for assemblies not in Library Mode.
Library Mode is enabled by default for all input assemblies. As a result, applications are likely to work after renaming. However, users may be concerned that so little of their application has been renamed. If appropriate, turning Library Mode off will allow Dotfuscator to rename much more.
Configuration
Configure Library Mode in the Config Editor.
Detailed Library Mode Effects
When Enabled
- Renaming
- Names of public classes and nested public classes are not renamed. Members (fields and methods) of these classes are also not renamed if they have public, family, or famorassem access.
- In addition, no virtual methods are renamed, regardless of access specifier. This allows clients of your library to override private virtual methods if necessary.
- Any user-specified custom renaming exclusions are applied in addition to the exclusions implied by the above rules.
- Property and Event metadata is always preserved.
- Removal
- Public classes are not removed, even if static analysis determines they are not required.
- Fields of these classes are not removed if they have public, family, or famorassem access.
- Methods of these classes are not removed if they have public, family, or famorassem access. In addition, such methods are treated as entry points; their call trees are followed and all subsequently called methods are also protected from removal.
When Disabled
- Renaming
- Everything is renamed except methods that override classes external to the application (i.e. classes in assemblies that are not included in the run).
- User-specified custom renaming exclusions are also applied.
- Property and Event metadata is removed, because it is not required to run the application.
- Removal
- Specifically included classes, methods, or fields are not removed.
- All trigger methods and fields are not removed.
- All classes, members, and fields that are excluded from renaming also become excluded from removal.
- All other classes, fields, and methods that are unreachable from some included class, method, or field are removed.