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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With