Search code examples
.netvisual-studioobfuscationeazfuscator

Obfuscating published app with Eazfuscator.NET?


I want to obfuscate my app with Eazfuscator.NET but I also want to publish it with ClickOnce (I use the Install from CD option). But Eazfuscator only let me obfuscate assemblies and I don't know which assembly to obfuscate when my project is published since there are many of them. Perhaps I need to obfuscate it before publishing it but still not sure how would this be done. Hope anyone can help.


Solution

  • Here is what I use.

    REM run from your publish\Application Files\AAA_w_x_w_z dir
    
    REM Remove the .deploy extensions, so Eazfuscator can find dlls
    REM and mage can find .config
    REM Use http://www.bulkrenameutility.co.uk/Download.php for this
    c:\BRC_Unicode_64\BRC64.exe /PATTERN:*.deploy /RECURSIVE /REMOVEEXT /EXECUTE
    
    REM Protect files 
    "c:\Program Files (x86)\Eazfuscator.NET\Eazfuscator.NET.exe" -k c:\signing\somesnk.snk dll1.dll dll2etc.dll 
    
    
    REM update hash files and sign 
    "c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\mage" -Update my.dll.manifest
    "c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\mage" -Sign my.dll.manifest -CertFile c:\signing\MyCodeSigning.p12 -Password 1234
    
    
    REM add the .deploy extension 
    c:\BRC_Unicode_64\BRC64.exe /PATTERN:*.dll /FIXEDEXT:.dll.deploy /EXECUTE
    c:\BRC_Unicode_64\BRC64.exe /PATTERN:*.config /FIXEDEXT:.config.deploy /EXECUTE
    c:\BRC_Unicode_64\BRC64.exe /PATTERN:*.gif /RECURSIVE /FIXEDEXT:.gif.deploy /EXECUTE
    
    REM update application file 
    cd ..
    cd ..
    
    "c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\mage" -Update my.vsto -AppManifest "Application Files\my_1_0_0_4\dll1.dll.manifest" 
    
    "c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\mage" -Sign my.vsto -CertFile c:\signing\MyCodeSigning.p12 -Password 1234
    

    You run this bat file after publishing.

    You'll need to adapt it, of course. Pass Eazfuscator.NET.exe a list of the DLLs you wish to obfuscate.

    The "my_1_0_0_4" needs to be changed to match the version published.