Incremental obfuscation allows Dotfuscator to reuse renamed types and members from a previous build. This helps keep a consistent naming scheme across multiple Dotfuscator runs.
Use incremental obfuscation when you need to release only part of an application, keep dependencies compatible with previously protected assemblies, or obfuscate a large application in smaller groups.
When to Use Incremental Obfuscation
Incremental obfuscation is useful when you need consistent renamed symbols across releases.
For example, suppose you protect and release an application that includes multiple assemblies. Later, you need to update only one assembly. If you run Dotfuscator again without using the previous mapping file, Dotfuscator may generate different renamed symbols. This may require you to redistribute the entire application.
With incremental obfuscation, Dotfuscator can reuse the previous names so that the updated assembly can continue to work with the assemblies from the earlier release.
Incremental obfuscation can also be useful in sequential build scenarios, especially when large applications need to be protected in smaller, more manageable groups of assemblies.
For example, if an application contains A.exe, B.dll, and C.dll, where A.exe references B.dll and B.dll references C.dll, you can protect C.dll first, then protect B.dll using the mapping file from C.dll, and finally protect A.exe using the mapping file from B.dll.
This approach can also help reduce build time when only some assemblies in an application need to be redistributed.
Required Map File
Incremental obfuscation requires an input mapping file that contains the names Dotfuscator should reuse.
The input mapping file uses the same format as the output mapping file that Dotfuscator creates after each run.
As a best practice, save a copy of the output mapping file for every released build of your application. Store this file in a safe internal location, such as version control, so it can be used later if an incremental update is needed.
Assembly Availability
When running incremental obfuscation, Dotfuscator must be able to access all assemblies in the application.
The assemblies do not all need to be included in the Dotfuscator configuration, but Dotfuscator must be able to discover them using its normal probing rules for referenced assemblies.
Recommended Workflow
To use incremental obfuscation:
- Protect your application for release.
- Save the output mapping file from the released build in a secure internal location.
- When you need to release an update, use the previous output mapping file as the input mapping file. In the Config Editor go to Rename > Options and provide the output map on the Map Input File field.
- Run Dotfuscator for the assemblies that need to be protected.