Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Mon Jul 19, 2010 8:23 am Post subject: HOWTO: Verify if an assembly is obfuscated. |
|
|
To verify whether Visual Studio integration using build events or MSbuild is working, or otherwise verify that an assembly has actually been obfuscated:
Method 1
Declare a private empty class:
[C#]
Code: | // Private class is sure to get renamed as long as "Rename Symbols" setting is checked (which it usually is)
private class TestObfuscation
{
}
|
[VB.Net]
Code: | 'Private class is sure to get renamed as long as "Rename Symbols" setting is checked (which it usually is)
Private Class TestObfuscation
End Class |
Then use following line of
[C#]
Code: | // Can use Trace.WriteLine or MessageBox.Show instead of Debug.WriteLine
// If this outputs "TestObfuscation", this means obfuscation is not done.
Debug.WriteLine(typeof(TestObfuscation).ToString()); |
[VB.Net]
Code: | 'Can use Trace.WriteLine or MessageBox.Show instead of Debug.WriteLine
'If this outputs "TestObfuscation", this means obfuscation is not done.
Debug.WriteLine(GetType(TestObfuscation).ToString())
|
Method 2
The first method does not work if you have turned of Symbol Renaming for your assembly. In this case, use this method:
1. Reference the LogicNP.CryptoObfuscator.ExceptionReporting.dll assembly (located in the installation folder) from your project.
2. Use the CryptoObfuscatorHelper.Utils.Obfuscated property from that assembly to determine whether the obfuscated or unobfuscated version of the assembly is running. This property automatically returns the correct value.
Note that even though the assembly name says LogicNP.CryptoObfuscator.ExceptionReporting.dll, exception reporting is only added to your assembly if you have enabled it for your assembly. |
|