Skip to content

ILSpy - .NET Decompiler Cheatsheet

ILSpy - .NET Decompiler Cheatsheet

ILSpy is the open-source .NET assembly browser and decompiler. It reverses the compilation process, converting Microsoft Intermediate Language (MSIL/CIL) back into readable, high-level C# (and other languages). It is the standard free tool for inspecting, analyzing, and reverse-engineering .NET binaries — from malware triage to debugging third-party libraries without source. It runs as a Windows GUI, a cross-platform Avalonia app, a VS Code extension, and the ilspycmd CLI.

Installation

VariantHow
Windows GUIDownload the installer/zip from GitHub Releases
Cross-platform GUIAvaloniaILSpy build (Linux/macOS)
CLI (ilspycmd)dotnet tool install --global ilspycmd
VS CodeInstall the “ILSpy .NET Decompiler” extension
Verify CLIilspycmd --version

GUI Essentials

ActionHow
Open assemblyFile → Open, or drag a .dll/.exe in
Load dependenciesILSpy resolves referenced assemblies automatically
NavigateExpand the tree: assembly → namespace → type → member
Decompile a memberClick it; C# appears in the main pane
Analyze usagesRight-click → Analyze (who calls/uses this?)
SearchCtrl+F / search box for types and members
Change language versionToolbar dropdown (C# 1.0 … latest)
Save decompiled projectFile → Save Code (export full .csproj)

Analyze (Cross-References)

Right-click → Analyze shows
Instantiated By
Used By
Assigned By / Read By (fields)
Overridden By / Overrides
Exposed By

This is the core RE workflow: pick a suspicious method and trace who calls it and what it touches.

ilspycmd (Command Line)

CommandDescription
ilspycmd Assembly.dllDecompile the whole assembly to stdout
ilspycmd -o out/ Assembly.dllDecompile to a directory
ilspycmd -p -o proj/ Assembly.dllExport a compilable .csproj project
ilspycmd -t Namespace.Type Assembly.dllDecompile a single type
ilspycmd -il Assembly.dllShow raw IL instead of C#
ilspycmd -lv CSharp10_0 Assembly.dllSet the C# language version
ilspycmd --nested-directories -p -o out/ A.dllMirror namespaces as folders
ilspycmd -r LIBDIR Assembly.dllAdd an assembly reference search path

Inspecting Metadata & Resources

TargetHow
Embedded resourcesTree → Resources node; extract via Save
Metadata tablesView → “Metadata” (raw tables, tokens)
Strings/ILSwitch the language dropdown to IL
PInvoke/nativeVisible in method signatures

Common Workflows

# Triage a suspicious .NET sample: full source dump for grepping
ilspycmd -o sample_src/ suspicious.dll
grep -rin "DownloadString\|FromBase64String\|Process.Start" sample_src/

# Recover a buildable project from a DLL you lost source for
ilspycmd -p -o recovered/ MyLib.dll

# Look at raw IL when the C# decompilation is obfuscated
ilspycmd -il obfuscated.dll | less

For heavily obfuscated assemblies, pair ILSpy with a deobfuscator (e.g. de4dot) first, then decompile the cleaned binary.

ILSpy vs Other .NET Tools

ToolTypeNotes
ILSpyDecompiler + browserFree, open-source, CLI + GUI
dnSpy / dnSpyExDecompiler + debuggerEdit & debug assemblies
dotPeekDecompilerFree (JetBrains), Windows
ILDASMDisassemblerIL only, ships with .NET SDK

Resources