Obfuscating your application's control flow
Published 31 December 2012
Control obfuscation changes the code inside your methods, converting it into 'spaghetti code'.
To use control flow obfuscation, in the Project Settings window, go to Control Flow Obfuscation or click the icon in the toolbar.
Select the assemblies to obfuscate.
When control flow obfuscation is enabled, the coloured bars under the toolbar icon and to the left of the feature options are green. If it is disabled, the bars are orange.
Choosing the level of control flow obfuscation
Choose the level of control flow obfuscation:
Select if you do not want to apply control flow obfuscation, or if you are using attributes to manage the control flow obfuscation. See Using custom attributes.
Strictly valid. Supports Mono
Strictly complies with .NET IL verifiability rules and is compatible with Mono.
Greatest level of obfuscation. May break rules of IL, and will not run on Mono.
Removes local variables from methods. This option offers an enhanced level of obfuscation, but it uses unverifiable code.
Regardless of the setting chosen, you can apply the Strongest level to any method by using the
[ObfuscateControlFlow] attribute. To exclude a certain method from Control Flow Obfuscation, use the
[DoNotObfuscateControlFlow] attribute. For more information, see Using custom attributes.
You can't use control flow obfuscation for assemblies using XNA.
Windows Phone 7.x applications and Xbox XNA applications can only use the Strictly valid level of control flow obfuscation.