小编Tor*_*ten的帖子

AstBuilder中的ILSpy“无法解析程序集”

我想反汇编我的程序集中的方法,该方法引用了例如“ Microsoft.SharePoint.dll”,但是我没有在计算机上安装SharePoint。如果使用以下代码,则会收到Mono.Cecil.AssemblyResolutionException'无法解析程序集Microsoft.SharePoint ...'。

AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly("PathToMyAssembly");
ICSharpCode.Decompiler.DecompilerContext context = new ICSharpCode.Decompiler.DecompilerContext(assembly.MainModule);
AstBuilder decompiler = new AstBuilder(context);
decompiler.AddMethod(method); <!-- here it crashes -->
Run Code Online (Sandbox Code Playgroud)

使用ILSpy GUI,我可以无错误地加载程序集(在没有SharePoint的同一台计算机上)。

我需要更改我的代码吗?

c# reflection decompiler mono.cecil ilspy

2
推荐指数
1
解决办法
1218
查看次数

标签 统计

c# ×1

decompiler ×1

ilspy ×1

mono.cecil ×1

reflection ×1