Dotfuscator User's Guide
Dotfuscating the Reflection Output

The reflection sample contains a sample Dotfuscator configuration file that demonstrates using exclusion rules to exclude these items invoked by reflection. This file is named reflection_config.xml and can be located in the same directory as the rest of the reflection samples. The section of the file that excludes these references is:

Using Exclusion Rules to Exclude Items Invoked by Reflection
Copy Code
      <type name="Samples.Greetings">
         <method name="SayGreetings" signature="string" />

The <renaming> tag indicates that the exclusion rules contained within pertain specifically to identifier renaming, as opposed to other Dotfuscator features which can also be selectively turned on or off.

The <excludelist> tag defines a list of items that must be excluded from the renaming process. The <type name="Samples.Greetings"> tag instructs Dotfuscator to exclude the class name "Samples.Greetings" from the renaming process. Note that this only refers to the class name itself. All methods and fields belonging to the "Greetings" class are still eligible to be renamed unless they are specifically excluded. We can see an example of this with the <method name="SayGreetings" signature="string" /> entry.

Executing the make.bat file will run Dotfuscator with this configuration file. The output of this process is a Reflection.exe assembly in the "output" subdirectory. This location can be controlled by modifying the following section in the configuration file:

Modifying Location of the Output
Copy Code
 <file dir="${projectdir}\output" />

Running the new assembly verifies that Dotfuscator correctly excluded the required items from the renaming process:

Friendly Messages Excluded from Renaming Process:
Copy Code
Hello Bob!
Goodbye Bob!




© 2017 PreEmptive Solutions, LLC. All Rights Reserved.