如何在不考虑C#中的其他依赖项的情况下反编译程序集?

时间:2016-12-19 05:13:35

标签: c# .net mono .net-assembly

这是我的代码,我想要实现的是反编译程序集。但是,当我开始这样做时,它会引发异常

  

Failed to resolve assembly: 'ICSharpCode.AvalonEdit, Version=5.0.3.0, Culture=neutral, PublicKeyToken=9cc39be672370310'

我想这意味着反编译器无法找到该程序集的其他依赖项。那么,是否有任何方法可以跳过查找其他依赖项但只是反编译代码?或者,如果有任何方法可以将其他依赖项放入反编译过程中?请帮忙!

foreach(var types in myASB.MainModule.Types)
{
    Console.WriteLine(types.Name);
    AstBuilder astBuilder = new AstBuilder(new DecompilerContext(myASB.MainModule)
    {
        CurrentType = types,
    });

    astBuilder.AddType(types);
    var writeText = new PlainTextOutput();

    astBuilder.GenerateCode(writeText);
    Files.WriteFileContent(Path.Combine(Directory.GetCurrentDirectory() + "/Code", Files.getSafeFileNameString(types.Name) + ".cs"), writeText.ToString());

}

0 个答案:

没有答案