c#命令行反编译器

本文关键字:反编译器 命令行 | 更新日期: 2023-09-27 18:14:08

我希望将许多程序集反编译为c#。我找到了几个可以进行可视化反编译的工具。然而,我想知道是否有一个工具可以从命令行进行反编译(类似于ildasm /OUT)。

动机是有100多个程序集,我不想打开每个程序集并保存为.cs文件。net反射器似乎有批量加载程序集,但它没有批量保存。所以我想写一个脚本,遍历每个程序集并使用命令行命令进行反编译。

c#命令行反编译器

如果你正在寻找一个程序为程序集生成c#代码,Jon Gallant最近有一篇关于使用Telerik的JustDecompile来做这件事的博客文章。有几个程序集,你可以链接到,然后你可以控制代码的生成没有UI。

您唯一需要的是这个名为dnSpy -> https://github.com/0xd4d/dnSpy的开源反编译器

包含命令行工具:

Examples:
  dnSpy.Console.exe -o C:'out'path C:'some'path
      Decompiles all .NET files in the above directory and saves files to C:'out'path
  dnSpy.Console.exe -o C:'out'path -r C:'some'path
      Decompiles all .NET files in the above directory and all sub directories
  dnSpy.Console.exe -o C:'out'path C:'some'path'*.dll
      Decompiles all *.dll .NET files in the above directory and saves files to C:'out'path
  dnSpy.Console.exe --md 0x06000123 file.dll
      Decompiles the member with token 0x06000123
  dnSpy.Console.exe -t system.int32 --gac-file "mscorlib, Version=4.0.0.0"
      Decompiles System.Int32 from mscorlib

就像上面的答案一样,当我试图使用它时,dnSpy似乎已经停止并崩溃了。

也许可以考虑使用dnSpyEx,它工作起来很有魅力。