C# commandline decompiler
Asked Answered
C

3

5

I'm looking to decompile a lot of assemblies into C#. I found several tools that do a visual decompile. However I was wondering if there is a tool that can do decompiling from the command line (similar to ildasm /OUT).

The motivation is that there are 100+ of assemblies and I don't want to open each one and save as an .cs file. .NET Reflector seems to have a batch load of assemblies, but it doesn't have a batch save. So I was thinking of writing a script that goes through each assembly and decompiles it using a command line command.

Chauffeur answered 11/11, 2011 at 21:5 Comment(0)
Q
3

If you are looking to have a program that generates the C# code for an assembly, Jon Gallant recently had a blog post about doing this using JustDecompile from Telerik. There are a couple of assemblies that you link to and then you can control the generation of the code without a UI.

Quenchless answered 11/11, 2011 at 21:12 Comment(0)
D
3

Just as a continuation of the answer from above, dnSpy seems to be discontinued and crashed for me when I tried to use it (like here).

Maybe consider using dnSpyEx, which worked like a charm.

Denotation answered 18/2, 2023 at 16:36 Comment(0)
F
2

The only thing you need is this open source decompiler called dnSpy -> https://github.com/0xd4d/dnSpy

includes a command line tool:

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
Fuge answered 10/5, 2020 at 13:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.