我想反汇编我的程序集中的方法,该方法引用了例如“ 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的同一台计算机上)。
我需要更改我的代码吗?