Smart Obfuscation
Smart Obfuscation is a feature of Dotfuscator which applies built-in obfuscation rules automatically for known API usage patterns and application types.
For example, if the assemblies use the names of a certain enumeration (via Enum.ToString(), etc.), Smart Obfuscation automatically excludes that enumeration's members from renaming, as the names are probably significant to the code or to users.
Sometimes Smart Obfuscation can recognize that an action needs to be taken, but cannot determine what specific action to take because static analysis does not yield enough information. When this happens, Smart Obfuscation issues a warning instead.
When Smart Obfuscation is enabled (which it is by default), building can produce, in addition to normal Build Output, Smart Obfuscation information and warnings. These display as additional tabs in the lower section of the user interface.
TransformXAML
TransformXaml parses markup files to identify elements for renaming and updates their corresponding references.
Supported Markup Formats
The feature supports the following binary and text-based formats:
| Format | Description |
| XBF | Binary format typically used in UWP and Windows 8.x apps. |
| BAML | XAML file encoded as binary, typically used in WPF. |
| XAML | Standard mark-up language for UI. |
Transform XAML is enabled by default. For more information, see Transform XAML By Assembly.
Declarative Obfuscation
In addition to configuring obfuscation transforms through the Dotfuscator user interface, Dotfuscator also obeys configuration specified declaratively in the assembly via standard .NET attributes. This process is known as Declarative Obfuscation.
To enable Declarative Obfuscation:
- Annotate your code with obfuscation attributes as appropriate.
-
Ensure that, for each relevant input assembly, the Honor obfuscation attributes option is enabled.
- We strongly recommend you also enable the Strip obfuscation attributes option, as these attributes are not needed after Dotfuscator has processed the assemblies.
- Build your Dotfuscator config.
For instance, consider a method that is known to be called by reflection. If Dotfuscator renames this method, the reflection lookup causes run time errors.
The ObfuscationAttribute can be used on this method to indicate that it should be excluded from renaming, as in the following code:
Invoked via Reflection, Excluded from Renaming:
[System.Reflection.Obfuscation(Exclude=true, Feature="renaming")]
public void CalledFromReflection(int someValue) {
When Dotfuscator processes the assemblies produced by this source code, it excludes the method from renaming, in addition to any exclusions in the config.
Suppress Ildasm Global Option
Dotfuscator can prevent your assemblies from being decompiled by adding the SuppressIldasmAttribute to all output assemblies. This also stops the official .NET disassembler, ildasm, from operating on your assemblies. Please note that this attribute only protects against ildasm decompilation and does not affect third-party tools.
You can enable this feature through the configuration file.