Understand implementation details of .NET code by decompiling assemblies. Use when you want to see how a .NET API works internally, inspect NuGet package source, view framework implementation, or understand compiled .NET binaries.
Install
npx skills add https://github.com/aaronontheweb/dotnet-skills --skill ilspy-decompileSKILL.md
.NET Assembly Decompilation with ILSpy
Use this skill to understand how .NET code works internally by decompiling compiled assemblies.
Prerequisites
- .NET SDK installed
- ILSpy command-line tool available via one of the following:
dnx ilspycmd(if available in your SDK or runtime)dotnet tool install --global ilspycmd
Both forms are shown below. Use the one that works in your environment.
Note: ILSpyCmd options may vary slightly by version.
Always verify supported flags withilspycmd -h.
Quick start
# Decompile an assembly to stdout
ilspycmd MyLibrary.dll
# or
dnx ilspycmd MyLibrary.dll
# Decompile to an output folder
ilspycmd -o output-folder MyLibrary.dll
Common .NET Assembly Locations
NuGet packages
~/.nuget/packages/<package-name>/<version>/lib/<tfm>/
.NET runtime libraries
dotnet --list-runtimes
.NET SDK reference assemblies
dotnet --list-sdks
Reference assemblies do not contain implementations.
Project build output
./bin/Debug/net8.0/<AssemblyName>.dll
./bin/Release/net8.0/publish/<AssemblyName>.dll
Core workflow
- Identify what you want to understand
- Locate the assembly
- List types
- Decompile the target
Commands
Basic decompilation
ilspycmd MyLibrary.dll
ilspycmd -o ./decompiled MyLibrary.dll
ilspycmd -p -o ./project MyLibrary.dll
Targeted decompilation
ilspycmd -t Namespace.ClassName MyLibrary.dll
ilspycmd -lv CSharp12_0 MyLibrary.dll
View IL code
ilspycmd -il MyLibrary.dll
Notes on modern .NET builds
- ReadyToRun images may reduce readability
- Trimmed or AOT builds may omit code
- Prefer non-trimmed builds
Legal note
Decompiling assemblies may be subject to license restrictions.
Related skills
modern-csharp-coding-standardsaaronontheweb2.1KWrite modern, high-performance C# code using records, pattern matching, value objects, async/await, Span<T>/Memory<T>, and best-practice API design patterns. Emphasizes functional-style programming with C# 12+ features.csharp-concurrency-patternsaaronontheweb1.5KChoosing the right concurrency abstraction in .NET - from async/await for I/O to Channels for producer/consumer to Akka.NET for stateful entity management. Avoid locks and manual synchronization unless absolutely necessary.efcore-patternsaaronontheweb1.5KEntity Framework Core best practices including NoTracking by default, query splitting for navigation collections, migration management, dedicated migration services, and common pitfalls to avoid.akka-net-best-practicesaarononthewebCritical Akka.NET best practices including EventStream vs DistributedPubSub, supervision strategies, error handling, Props vs DependencyResolver, work distribution patterns, and cluster/local mode abstractions for testability.