|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Dotfuscator Professional Edition has the ability to statically analyze your application and determine which pieces are not actually being used. This includes searching for unused types, unused methods, and unused fields. This is of great benefit if application size is a concern, particularly if you are building your application from reusable components. Typically, not every type, method, and field is used in such applications. Dotfuscator can extract exactly the pieces you need for any given application, making it the absolute smallest it can be.
The static analysis works by traversing your code, starting at a set of methods called “triggers”. These are your application’s 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.
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. These and only these types are included in the output assembly.
For details, see the online user's guide.