To obfuscate all the files I first create a project for every file and then I build each project. Here is the /create command:
SmartAssembly /create projectName.saproj /input=Example.exe /output=$self /keyfilename="MyKey.snk" /tamperprotection=true /reducemem=true /sealclasses=true /preventildasm=true /methodparentobfuscation=true /fieldobfuscation=3 /typemethodobfuscation=3 /stringsencoding=true;improved:true,compressencrypt:true,cache:true /errorreportingtemplate=auto;email="email@example.com" /reportappname="Example" /reportcompanyname="Example.com" /assembly="Example";prune:true,nameobfuscate:true,controlflowobfuscate:3,dynamicproxy:true,compressencryptresources:true
The problem is when I try to execute my file after the obfuscation, it crashes with the following error:
An unhandled exception of type 'System.IO.FileLoadException' occurred in Unknown Module.
Additional information: Could not load file or assembly 'SomeDLL, Version=18.104.22.168, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
When I obfuscate without strong naming the assemblies then it works fine. Any ideas where the problem is? Thanks
I might actually have an idea why it is failing... Basically I programmatically enumerate a folder full of assemblies, grab them in alphabetic order and build them one by one. I think the problem is that I first build an assembly that has dependencies (which dependency has not yet been build and strong signed), and only then I build and strong sign the dependent assembly (as it comes later in alphabetic order)... Any idea how to overcome this other than manually specifying the build order?