.NET framework provides a set of custom attributes that allows to describe meta properties of a given class, field, property or method.
For example, Windows Forms and WPF visual designers use System.ComponentModel.DescriptionAttribute
to
find the textual descriptions for editable class properties.
There are other use cases and they are numerous.
Eazfuscator.NET automatically prunes excessive meta attributes whenever possible. However you may prefer to remove all custom attributes with given conditions in some scenarios to achieve better obfuscation coverage.
Suppose we want to remove System.ComponentModel.DescriptionAttribute
from every class member of the assembly.
Please follow the instructions below to achieve that.
- Open obfuscatable project inside the IDE
-
Add new source file to the project and
call it
ObfuscationSettings.cs
(for C#) orObfuscationSettings.vb
(for Visual Basic .NET). You may prefer to use another name instead ofObfuscationSettings.cs
orObfuscationSettings.vb
-
Fill
ObfuscationSettings.cs
with the following content (C#):using System; using System.Reflection; [assembly: Obfuscation(Feature = "Apply to type *: apply to member *: remove custom attribute System.ComponentModel.DescriptionAttribute", Exclude = false)]
For Visual Basic .NET, fill
ObfuscationSettings.vb
with the following content:Imports System Imports System.Reflection <Assembly: Obfuscation(Feature:="Apply to type *: apply to member *: remove custom attribute System.ComponentModel.DescriptionAttribute", Exclude:=False)>
Tip | |
---|---|
You can use specific conditions to define the scope of custom attributes removal. See conditional obfuscation for details. |
Tip | |
---|---|
You can specify any class name instead of |
Tip | |
---|---|
|