PreEmptive Protection - Dotfuscator
Community Edition

Obfuscation Attributes

The .NET Framework Class Library defines two attributes that can be used to indicate to Dotfuscator how the annotated source elements should be obfuscated. This page details the use of these attributes.

All of the following attributes are defined in the System.Reflection namespace, which for brevity will be omitted from the titles of the sections below.

These attributes can only be used in source code (the attributes are defined in mscorlib.dll, which is referenced by all other assemblies). There is no extended attribute support for these attributes like there is for Checks and Analytics. Instead, you configure obfuscation at the project level via manual exclusions and exclusion rules.

ObfuscationAttribute

Specifies how a code element should be obfuscated. Practically speaking, in Dotfuscator Community Edition, this means it can specify that the annotated type or member should be excluded from renaming. Additional transforms are available in Professional Edition.

  • Applies to: Type or member
  • Prerequisites: None
  • Properties
    • Feature: The name of the obfuscation transform to specify. Defaults to "all".
      • "renaming": Dotfuscator's renaming feature.
      • "all" or "default": Alias of "renaming".
      • Project-specific Feature Map Strings: Alias of the feature specified in the project (which is always "renaming" in Community Edition).
    • Exclude: If true, Dotfuscator will exclude the annotated code element from the specified feature. Defaults to true.
    • ApplyToMembers: If attributing a type, indicates whether the members of the type should also be excluded. Defaults to true.
    • StripAfterObfuscation: If true, Dotfuscator will remove this attribute usage from the output assembly. Defaults to true.
      • Dotfuscator will always strip all attribute usages from an input assembly, regardless of this property, when the Strip obfuscation attributes input option is enabled, which it is by default.

ObfuscateAssemblyAttribute

Specifies how an assembly should be obfuscated. For Dotfuscator, this specifies whether or not the assembly is considered a library assembly or not.

  • Applies to: Assembly
  • Prerequisites: None
  • Properties
    • AssemblyIsPrivate: If true, Dotfuscator will consider the assembly to be a non-library assembly, and therefore obfuscate more aggressively. If false, Dotfuscator will consider the assembly to be a library assembly, and therefore preserve the public contract of the assembly. Defaults to false.
      • This overrides the Library Mode input option.
    • StripAfterObfuscation: If true, Dotfuscator will remove this attribute usage from the output assembly. Defaults to true.
      • Dotfuscator will always strip all attribute usages from an input assembly, regardless of this property, when the Strip obfuscation attributes input option is enabled, which it is by default.


Dotfuscator Version 5.27.0.4687. Copyright © 2017 PreEmptive Solutions, LLC