1

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.

Darzy08
  • 105
  • 1
  • 4
  • 14
  • something is wrong with your ould not resolve assembly: Discord.Net.WebSocket, Version=1.0.2.0, Culture=neutral, PublicKeyToken=nul – Or Yaacov Mar 06 '19 at 05:30
  • 1
    Is the Discord.Net.WebSocket dll in the bin folder and is it the correct version? – Emond Mar 06 '19 at 05:35
  • @OrYaacov yes its same version. – Darzy08 Mar 06 '19 at 05:40
  • add the right assemblyBinding into your config file https://stackoverflow.com/questions/27544918/configuration-of-net-assembly-binding-of-any-newer-assembly-version-in-app-conf – Or Yaacov Mar 06 '19 at 05:44

2 Answers2

4

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.

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

I solved the problem by adding Probe Paths to ConfuserEx settings.

In Visual Studio, choose Tools > ConfuserEX Probe Paths.

enter image description here

This will bring up Probe Paths dialog. Add your paths in this dialog.

enter image description here

Keep in mind that you have to enter the exact path of the folder where the DLL is located about which ConfuserEX is complaining. Unfortunately it does not search sub-folders, so you can't specify packages folder once for all your dependencies.

dotNET
  • 33,414
  • 24
  • 162
  • 251