DeployLX Software Protection System

Obfuscation Rules

DeployLX CodeVeil supports a powerful rule system for selecting and excluding specific members from the obfuscation process. This topic discusses the use of those rules.

In This Topic

What is Obfuscation?

Obfuscation is the process of renaming various symbols stored in the meta-data of an assembly to nonsensical values to prevent unauthorized users from reading your source code and reverse-engineering your assemblies.

The names of Types, Methods, Properties, Fields and other assembly members are renamed during the obfuscation stage of the veiling process. This can sometimes cause problems at runtime because .NET expects some classes, resources and other assembly members to follow specific naming conventions to relate to each other. Using obfuscation rules will allow you to easily exclude or include specific symbols from the obfuscation process.

See the What is Obfuscation topic for a complete discussion of obfuscation.

Rule Properties

Rename matching objects Indicates if types and members that match the rule should be renamed.
Pattern The search pattern for a custom obfuscation selection rule. You can use the * and ? wildcards to match multiple and individual characters.
Treat as a regular expression When selected the Pattern is treated as a regular expression.
Object Types

The types of objects to match.


Matches all object types.


Clears object selection.


The visibility of the objects to match.


Matches all visibilities.


Selects Public, Protected and Protected Internal.


Selects Internal and Private.

Comments Comments and / or notes about the rule.

How Rules Work

CodeVeil considers a number of factors to determine if an assembly member should be obfuscated. Certain types, like auto-serializable types, and members, such as constructors, cannot be renamed and will not be considered when evaluating the rules.

If CodeVeil determines that the member does not have any special naming requirements, then it will first check for explicit obfuscation options selected in the Member Override or defined with Compile Time Attributes. If no explicit option has been applied, then CodeVeil finally considers the assembly defined obfuscation selection rules.

For each assembly member that is evaluated, the full name of the member is resovled. For types this includes the containing namespace and any parent types of nested types. For type members (methods, properties, fields, events) this will include the full name of the parent type followed by the member name. The parameters of a method or property are not included in the full name of the member so you cannot distinguish between overloaded members in a rule.

If the rule pattern matches the full name of the member, then the object type is considered. Finally the visibility of the member is evaluated to determine if it is within the range of visibilities chosen by the rule.

If the member matches all the conditions of the rule then the obfuscation option will be applied to that member. If the rule does not match, evaluation continues through all the custom rules in the assembly. If no custom rules match, then one of the intrinsic rules will be applied.

Intrinsic Rules

When no rules match, or there are no custom rules defined, CodeVeil will apply one of the following intrinsic rules.

When Private Assembly is not selected
* | Don't Obfuscate | All Members | All Public

Excludes all members that are publicly visible (Public, Protected and Protected Internal) from obfuscation.

* | Obfuscate | All Members | Private

Include all members that have private visibility (Private, Internal)

When Private Assembly is selected
* | Obfuscate | All Members | All

Obfuscates all assembly members.

Child Members

Child members of a member that matches a rule do not automatically match the rule. Instead they follow the same inheritance logic as if the parent member had its obfuscation property set explicitly.

Adding Rules to Your Project

To add a Rule to your Project

  1. Open your Project in the Project Editor.
  2. Select the assembly from the list that you want to apply the rule to.
  3. Select Properties from the CodeVeil tab.
  4. Scroll to the Obfuscation Selection Rules section and select the Add button.
  5. This open the Obfuscation Selection Rule Form.
  6. Modify the pattern and select the appropriate settings to match the target assembly members.


Examine the following class tree. The examples will reference this tree. Private members are shown in a light gray, public in full black.

Rule Behavior
*.IInterface* | Obfuscate | All Members | Public Obfuscates IInterfacePublic, IInterfacePublic.PublicMethod and IInterfacePublic.PublicProperty.
*.InternalProperty | Don't Obfuscate | All Members | All Excludes IInterfaceInternal.InternalProperty and InterfacePublicClassImplicit.InternalProperty from obfuscation.
*Public* | Obfuscate | Properties | All Obfuscates IInterfacePublic.PublicProperty, InterfacePublicClassImplicit.PublicProperty.

See Also