ObfuscationAttribute.StripAfterObfuscation 屬性

定義

取得或設定 Boolean 值,指出模糊化工具是否應該在進行處理後移除這項屬性。

C#
public bool StripAfterObfuscation { get; set; }

屬性值

如果模糊化工具應該在進行處理後移除屬性,則為 true,否則為 false。 預設為 true

範例

下列程式代碼範例顯示 ObfuscationAttributeStripAfterObfuscation 屬性為 false 的 ,因此模糊化工具不會在模糊化之後移除屬性。 您必須為 屬性指定 falseExclude ,以避免從模糊化排除 MethodA ,因為屬性的 Exclude 預設值為 true

此程式代碼是可編譯和執行之較大範例的一部分。 請參閱 ObfuscationAttribute 類別。

C#
[ObfuscationAttribute(Exclude=true, ApplyToMembers=false)]
public class Type2
{

    // The exclusion of the type is not applied to its members,
    // however in order to mark the member with the "default"
    // feature it is necessary to specify Exclude=false,
    // because the default value of Exclude is true. The tool
    // should not strip this attribute after obfuscation.
    [ObfuscationAttribute(Exclude=false, Feature="default",
        StripAfterObfuscation=false)]
    public void MethodA() {}

    // This member is marked for obfuscation, because the
    // exclusion of the type is not applied to its members.
    public void MethodB() {}
}

備註

如果您的連結庫會包含在另一個應用程式的一部分,並模糊化為該應用程式的一部分,則不應該移除屬性。

重要

套用此屬性不會自動模糊您套用它的程式代碼實體。 套用 屬性是建立混淆工具組態檔的替代方案。 也就是說,它只會提供模糊化工具的指示。 Microsoft 建議廠商遵循此處所述的語意來混淆工具。 不過,不保證特定工具遵循 Microsoft 建議。

適用於

產品 版本
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1