0

I want reduce the assembly dimension with Costura.Fody, this working well, infact all the dll are merged in one assembly, but I have a problem with ConfuserEx that I can't solve.

In particular when I open ConfuserEx, I drag the .exe on the app, add the rule, and then press Confuse to obfuscate the .exe. I get this error:

[DEBUG] Building pipeline... [INFO] Resolving dependencies... [ERROR] Failed to resolve dependency of 'MyApp.exe'. Exception: dnlib.DotNet.AssemblyResolveException: Could not resolve assembly: MahApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null in dnlib.DotNet.Extensions.ResolveThrow(IAssemblyResolver self, IAssembly assembly, ModuleDef sourceModule) in E:\Source\Public\Confuser2\dnlib\src\DotNet\IAssemblyResolver.cs:riga 113 in Confuser.Core.ConfuserEngine.Inspection(ConfuserContext context) in e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngine.cs:riga 264 Failed at 11:15, 0:00 elapsed.

this happen only when I use Costura.Fody, 'cause now in the bin/debug folder there are only the "reduced" assemblies by Costura, I doesn't have the dll that ConfuserEx are looking for.

How can I manage this situation?

Thanks.

4 Answers4

1

Manually copy the referenced assemblies into the folder where the .exe is located, or edit FodyWeavers.xml as follows:

<Weavers>
  <Costura DisableCleanup='true'/>
</Weavers>  

Your references will still be merged into one .exe by Costura.Fody, however ConfuserEx needs the references to be in the same folder in order to work.

Skelvir
  • 64
  • 5
0

DisableCleanup="true" does not work as it leaves compressed renamed assemblies in obj\Costura folder.

Adding DisableCompression="true" leaves the uncompressed source assemblies, however the file is still renamed with a numbered.costura prefix. Manual renames to original names required.

Based on the above answer, the simplest solution that seemed to work for me is to:

  1. Use default FodyWeavers.xml below, run build to create costura reduced executable.

    <Weavers> <Costura /> </Weavers>

  2. Copy output executable with config and pdb to another folder (I use packed subfolder)
  3. Disable Costura weaver (comment Costura tag in the above xml), and run build again, which generates all the dlls in bin\debug folder.
  4. Overwrite executable with reduced executable copied from step-2.
  5. Run ConfuseEx and load reduced executable (step 4)

Source: https://github.com/Fody/Costura/

RSK
  • 29
  • 1
  • 6
0

The currently best option is to disable the usage of Costura entirely and use the packer that is integrated in ConfuserEx. That has the additional advantage that the additional assemblies can be obfuscated as well.

Nitram
  • 6,486
  • 2
  • 21
  • 32
0

I had this issue as well. I resolved it by adding a probe path to where the original dll files were and it was then able to continue with no errors.

LCB
  • 5
  • 3