Strong name multiple assemblies
Alex123456
Posts: 6
In my application I have 2 executables and about 50 dlls. I don't want to combine the dlls because I want to have the flexibility of updating individual dlls without shipping the 60MB+ executable to the client.
To obfuscate all the files I first create a project for every file and then I build each project. Here is the /create command:
The problem is when I try to execute my file after the obfuscation, it crashes with the following error:
When I obfuscate without strong naming the assemblies then it works fine. Any ideas where the problem is? Thanks
EDIT
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?
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="example@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=5.0.75.5, 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
EDIT
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?
Comments
I'm afraid I don't have any ideas myself. Specifying the build order sounds like the only option in this case.
Jessica Ramos | Product Support Engineer | Redgate Software
Have you visited our Help Center?