Smaller applications download faster, install faster, load faster and run faster. Dotfuscator's pruning feature statically analyzes your code to find the unused types, methods, and fields, and removes them. Dotfuscator also removes debug information and non-essential metadata from a MSIL file as it processes it, making the application smaller and reducing the data available to an attacker.
The static analysis works by traversing your code, starting at a set of methods called “triggers," or entry points. In general, any method that you expect external applications to call must be defined as a trigger. For example, in a simple standalone application, the
Main method would be defined as a trigger. An assembly can have more than one trigger defined for it.
Note that turning on library mode for an assembly causes Dotfuscator to treat all visible types and members as entry points, automatically.
As Dotfuscator traverses each trigger method’s code, it notes which fields, methods, and types are being used. It then analyses all the called methods in a similar manner. The process continues until all called methods have been analyzed. Upon completion, Dotfuscator is able to determine a minimum set of types and their members necessary for the application to run. Only these types are included in the output assembly.
Dotfuscator generates a removal report in XML format that lists all input assemblies and how each was pruned. Each assembly listing has a listing of types and their members (methods, fields, properties, etc.) along with an attribute indicating whether the item was pruned or not. The report also describes how managed resources attached to each assembly were pruned. At the end, the report provides a statistics section regarding the overall effectiveness of pruning.