This setting tells Dotfuscator that a particular input assembly constitutes a library. For Dotfuscation purposes, a library is defined as an assembly that is referenced from other components not specified as one of the inputs in this run. This has implications for renaming and pruning, regardless of any custom excludes you may have set.
Here are the rules when using the library option:
- 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 are always preserved.
- Pruning Rules.
- 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, so their call trees are followed and all subsequently called methods are also protected from removal.
If you do not have the library option set for an assembly, then you are telling Dotfuscator that your input assembly is a standalone application, or that it will only be referenced by other input assemblies. In this case obfuscation is more aggressive:
- Everything is renamed except methods that override classes external to the application (i.e. classes in assemblies that are not included in the run.)
- Property and Event metadata is removed, since this metadata is not required to run the application.
- User specified custom renaming exclusions are also applied.
- Pruning Rules
- Specifically included classes, methods, or fields are not pruned.
- All trigger methods and fields are not pruned.
- All classes, members, and fields that are excluded from renaming also become excluded from pruning.
- All other classes, fields, and methods that are unreachable from some included class, method, or field are pruned.
To specify library mode for an input assembly, add an
<option> element to its
|Library Mode by Assembly
<file dir="c:\temp" name="myproj.dll"/>