yck1509 / ConfuserEx

An open-source, free protector for .NET applications
http://yck1509.github.io/ConfuserEx/
Other
3.55k stars 1.62k forks source link

TypeResolveException: Could not resolve type: Microsoft.Practices.EnterpriseLibrary.Common.Configuration.NameTypeConfigurationElementCollection`2 #27

Closed icnocop closed 10 years ago

icnocop commented 10 years ago

Hi.

Thank you for ConfuserEx. Windows 7 x64 SP1 .NET Framework 3.5 Assembly Confuser 0.1.2

Confuser.CLI.exe MyAssembly.crproj MyAssembly.crproj:

<?xml version="1.0" encoding="utf-8"?>
<project baseDir="." outputDir="." xmlns="http://confuser.codeplex.com">
    <rule preset="none" pattern="true">
        <protection id="anti debug" />
        <protection id="anti dump" />
        <protection id="anti ildasm" />
        <protection id="anti tamper" />
        <protection id="constants" />
        <protection id="ctrl flow" />
        <protection id="invalid metadata" />
        <protection id="ref proxy" />
        <protection id="rename" />
        <protection id="resources" />
    </rule>
    <module path="MyAssembly.exe" snKey="..\StrongName.snk" />
</project>

Output:

 [INFO] ConfuserEx v0.1.0-21-g8d974cf Copyright (C) Ki 2014
 [INFO] Running on Microsoft Windows NT 6.1.7601 Service Pack 1, .NET Framework
v2.0.50727.5477, 64 bits
[DEBUG] Discovering plugins...
 [INFO] Discovered 10 protections, 1 packers.
[DEBUG] Resolving component dependency...
 [INFO] Loading input modules...
 [INFO] Loading 'MyAssembly.exe'...
 [INFO] Initializing...
[DEBUG] Building pipeline...
 [INFO] Resolving dependencies...
[DEBUG] Checking Strong Name...
 [WARN] [MyAssembly.exe] SN Key is not provided for a signed module, the
 output may not be working.
[DEBUG] Creating global .cctors...
[DEBUG] Watermarking...
[DEBUG] Building VTables & identifier list...
[DEBUG] Analyzing...
[ERROR] Failed to resolve a type, check if all dependencies are of correct versi
on.
Exception: dnlib.DotNet.TypeResolveException: Could not resolve type: Microsoft.
Practices.EnterpriseLibrary.Common.Configuration.NameTypeConfigurationElementCol
lection`2
   at dnlib.DotNet.TypeRef.ResolveThrow() in e:\Source\Public\Confuser2\dnlib\sr
c\DotNet\TypeRef.cs:line 331
   at Confuser.Renamer.Analyzers.InterReferenceAnalyzer.Analyze(ConfuserContext
context, INameService service, IDnlibDef def) in e:\Source\Public\Confuser2\Conf
user.Renamer\Analyzers\InterReferenceAnalyzer.cs:line 36
   at Confuser.Renamer.AnalyzePhase.Analyze(NameService service, ConfuserContext
 context, IDnlibDef def, Boolean runAnalyzer) in e:\Source\Public\Confuser2\Conf
user.Renamer\AnalyzePhase.cs:line 69
   at Confuser.Renamer.AnalyzePhase.Execute(ConfuserContext context, ProtectionP
arameters parameters) in e:\Source\Public\Confuser2\Confuser.Renamer\AnalyzePhas
e.cs:line 47
   at Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action`
1 func, Func`1 targets, ConfuserContext context) in e:\Source\Public\Confuser2\C
onfuser.Core\ProtectionPipeline.cs:line 130
   at Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, Conf
userContext context) in e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngine.
cs:line 187
   at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, Ca
ncellationToken token) in e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngin
e.cs:line 146
Failed at 5:03 PM, 0:04 elapsed.

The assembly has been merged with ilmerge but doesn't include Microsoft.Practices.EnterpriseLibrary.Common.dll. In either case, Microsoft.Practices.EnterpriseLibrary.Common.dll exists in the same directory as MyAssembly.exe.

Any ideas?

Thank you.

yck1509 commented 10 years ago

Please use ILSpy to confirm that the type Microsoft.Practices.EnterpriseLibrary.Common.Configuration.NameTypeConfigurationElementCollection exists Microsoft.Practices.EnterpriseLibrary.Common.dll. Also, try changing the output directory to a different one.

icnocop commented 10 years ago

Thank you.

Yes, that type exists in that dll.

I noticed that there was an assembly that was referenced that was already obfuscated.

Once I replaced that assembly reference with one that was not obfuscated, I got past this error, but getting Issue #29 instead.

So if trying to obfuscate an assembly that has a reference to an assembly that is already obfuscated is not (going to be) supported, then we can close this issue. :)

Thank you.

yck1509 commented 10 years ago

I did not test with obfuscated assemblies reference, however, ConfuserEx should work with them as long as they are not too heavily obfuscated. Do you know what obfuscator is used to obfuscate them?

icnocop commented 10 years ago

I was using the free edition of Eazfuscator.NET (before it went commercial).

yck1509 commented 10 years ago

That's strange. It should work with it... Would it be possible to post the obfuscated assembly reference for me to have a look?

yck1509 commented 10 years ago

Close due to inactivity. If you're are still encountering this issue, please feel free to reopen the issue with information.