csharp-decompile

j-r-beckett's avatarfrom j-r-beckett

Decompile .NET assemblies to inspect types, understand implementations, debug third-party libraries, and view IL code. Use when debugging NuGet dependency behavior, understanding compiled code, investigating runtime issues, or exploring unfamiliar assemblies.

⭐0stars🔀0forks📁View on GitHub🕐Updated Jan 3, 2026

When & Why to Use This Skill

This Claude skill enables the decompilation of .NET assemblies into readable C# source code or Intermediate Language (IL) using ilspycmd. It empowers developers to explore type hierarchies, understand third-party library implementations, and troubleshoot complex NuGet dependency issues directly within the AI workflow, even when source code is unavailable.

Use Cases

  • Debugging Third-Party Libraries: Inspect the internal logic of closed-source NuGet packages to identify bugs or understand undocumented behaviors.
  • Legacy Code Recovery: Reconstruct C# projects and source files from compiled .dll or .exe files when the original source code is lost.
  • Runtime Issue Investigation: Analyze IL code and sequence points to diagnose low-level runtime errors, performance bottlenecks, or compiler-generated code.
  • Security Auditing: Explore unfamiliar assemblies to investigate potential security vulnerabilities or verify the integrity of compiled binaries.
  • Architectural Analysis: Generate type diagrams and list assembly members to quickly visualize the structure and relationships within a complex .NET project.
namecsharp-decompile
descriptionDecompile .NET assemblies to inspect types, understand implementations, debug third-party libraries, and view IL code. Use when debugging NuGet dependency behavior, understanding compiled code, investigating runtime issues, or exploring unfamiliar assemblies.

C# Decompilation with ilspycmd

Decompile .NET assemblies to C# source code or IL using ilspycmd.

Setup

Ensure ilspycmd is installed:

ilspycmd --version || dotnet tool install --global ilspycmd

Workflows

List Types in an Assembly

Discover what's in an assembly before decompiling:

# List all types: classes, interfaces, structs, delegates, enums
ilspycmd -l cisde /path/to/assembly.dll

Decompile to a Project

Generate a compilable C# project from an assembly:

ilspycmd --nested-directories -p -o /tmp/decompiled /path/to/assembly.dll

This creates a .csproj and source files organized by namespace.

Important: this lets Claude code bring its sophisticated code reading and exploration tools to bear.

Decompile a Specific Type

Target a single type by its fully qualified name:

ilspycmd -t MyNamespace.MyClass /path/to/assembly.dll

The output goes to stdout. Use this to quickly inspect a type's implementation.

View IL Code

For low-level analysis, view the intermediate language:

ilspycmd -il -t MyNamespace.MyClass /path/to/assembly.dll

# With sequence points (source line mappings)
ilspycmd --il-sequence-points -t MyNamespace.MyClass /path/to/assembly.dll

Debug NuGet Dependencies

NuGet packages are at ~/.nuget/packages/<package-name>/<version>/lib/<tfm>/. To inspect:

# Find the DLL
find ~/.nuget/packages/sixlabors.imagesharp -name "*.dll" | grep -v ref

# List types
ilspycmd -l cisde ~/.nuget/packages/sixlabors.imagesharp/3.1.11/lib/net6.0/SixLabors.ImageSharp.dll

# Decompile a specific type
ilspycmd -t "SixLabors.ImageSharp.Numerics" ~/.nuget/packages/sixlabors.imagesharp/3.1.11/lib/net6.0/SixLabors.ImageSharp.dll

Generate Type Diagrams

Create an interactive HTML visualization of type relationships:

ilspycmd --generate-diagrammer -o /tmp/diagrammer /path/to/assembly.dll

# With filtering
ilspycmd --generate-diagrammer -o /tmp/diagrammer \
  --generate-diagrammer-include "MyNamespace\\..*" \
  --generate-diagrammer-exclude "MyNamespace\\.Internal\\..*" \
  /path/to/assembly.dll

These are mostly useful for the user. Let the user know that they're available.

Tips

  • Add -r /path/to/deps when the assembly has dependencies that aren't automatically resolved
  • Use --no-dead-code and --no-dead-stores for cleaner output
  • For tight loops or scripts, add --disable-updatecheck
  • The -lv Latest flag is default; use -lv CSharp9_0 etc for older language features

Fixes