.netvb.netconfuserex

Failed to resolve dependency of exe .Net


Hello i try to compile/protect test.exe project. using "ConfuserEx"

error i got :

[ERROR] Failed to resolve dependency of 'test.exe'. Exception: dnlib.DotNet.AssemblyResolveException: Could not resolve assembly: Discord.Net.WebSocket, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null at dnlib.DotNet.Extensions.ResolveThrow(IAssemblyResolver self, IAssembly assembly, ModuleDef sourceModule) in E:\Source\Public\Confuser2\dnlib\src\DotNet\IAssemblyResolver.cs:line 113 at Confuser.Core.ConfuserEngine.Inspection(ConfuserContext context) in e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngine.cs:line 264 Failed at 7:06 AM, 0:01 elapsed.

to explain more, i have dll's , i must merge them inside program, using .NET Reactor compiler, after that i using "ConfuserEx" to protect, and got that error.

i believe on stackoverflow devs power, and thanks.


Solution

  • Issues like this can usually be worked around by adding the affected assembly as external assembly to the ConfuserEx project.

    This can be done in the *.crproj file by adding:

    <module path="Discord.Net.WebSocket.dll" external="true" />
    

    Fix the path value as required. This will instruct ConfuserEx to load the specific assembly before starting to resolve the types. This way you have the required control on what assemblies are loaded.

    The external="true" part means that the assembly is not subject to packing or to obfuscating itself, but is only used to resolve references.

    So in the end the ConfuserEx project file should look something like this:

    <project outputDir=".\Confused" baseDir="." xmlns="http://confuser.codeplex.com">
      <rule pattern="true" …>
        …
      </rule>
      <module path="test.exe" />
      <module path="Discord.Net.WebSocket.dll" external="true" />
    </project>
    

    The paths are likely to differ.