The Removal Editor allows you to configure Dotfuscator's Removal feature.
From this editor, you can:
- Define Removal entry points (Include Triggers)
- Configure Conditional Includes
- Apply built-in inclusion rules
- Configure Removal behavior
The editor contains four tabs:
| Tab | Purpose |
|---|---|
| Include Triggers | Define entry points for Removal analysis. |
| Conditional Includes | Preserve specific code elements without traversing their call graph. |
| Built-In Rules | Configure predefined inclusion rules provided by Dotfuscator. |
| Options | Configure how Removal processes assemblies. |
Include Triggers Tab
The Include Triggers tab defines the starting points for Removal analysis.
When a method is configured as an Include Trigger:
- The method is preserved.
- Dotfuscator analyzes all code reachable from that method.
- Referenced types, methods, and fields are preserved automatically.
Typical triggers include:
- Application entry points (Main)
- Public API methods
- Methods called by external applications
- Framework entry points
Selecting Specific Items
Use the application tree to select methods that should act as triggers.
The left pane displays the assemblies and members available for selection.
Creating Custom Inclusion Rules
In addition to selecting individual items, you can create custom inclusion rules.Namespace and type rules support the same rule-building functionality used throughout Dotfuscator.
For more information, see The Rules Editor.
Previewing Rules
Use Preview to verify which items are selected by a rule before building.
The application tree highlights matching elements, allowing you to validate the rule's behavior.
Conditional Includes Tab
The Conditional Includes tab preserves specific methods without analyzing their descendants.
When a method is configured as a Conditional Include:
- The method is preserved.
- The method's call graph is not traversed automatically.
- Referenced methods may still be removed if they are not reachable through another trigger.
Use Conditional Includes when a method must remain available but should not automatically preserve all code it references.
The Conditional Includes tab supports the same application tree view and custom rule functionality as the Include Triggers tab.
Built-In Rules Tab
The Built-In Rules tab provides access to predefined inclusion rules supplied by Dotfuscator. These rules help preserve code patterns that may not be fully discoverable through static analysis alone.
Use this tab to review and enable built-in rules appropriate for your application.
The rule definitions are found in the XML file with a name beginning with dotfuscatorReferenceRule in your installation location's Common subdirectory.
Options Tab
The Options tab controls how Removal processes assemblies.
Removal Kind
Select one of the following modes:
| Option | Description |
|---|---|
| Remove unused metadata and code | Removes unused types, methods, fields, resources, and metadata. |
| Remove only literals (const definitions) | Removes constant literal definitions while preserving other code. |
Using Removal with String Encryption
When String Encryption is enabled, it is recommended to enable Removal and select:
Remove only literals (const definitions)
This removes original string constants after String Encryption has processed them.
Best Practices
- Test applications thoroughly after enabling Removal.
- Configure Include Triggers for all application entry points.
- Add Conditional Includes when runtime-discovered methods must be preserved.
- Review built-in rules before building protected assemblies.
- Use Remove only literals (const definitions) when combining Removal with String Encryption.
- Enable Library Mode when protecting reusable libraries.
Related Articles
- Optimize Your Application with Removal
- Configure Library Mode
- Protect Sensitive Strings with String Encryption
- The Rules Editor