| name | ilspy-decompile |
| description | Understand implementation details of .NET code by decompiling assemblies. Use when the user wants to see how a .NET API works internally, inspect NuGet package source, view framework implementation, or understand compiled .NET binaries. |
| allowed-tools | Bash(dnx:*) |
.NET Assembly Decompilation with ILSpy
Use this skill to understand how .NET code works internally by decompiling compiled assemblies.
Quick start
dnx ilspycmd MyLibrary.dll
dnx ilspycmd -o output-folder MyLibrary.dll
Common .NET Assembly Locations
NuGet Packages
~/.nuget/packages/<package-name>/<version>/lib/<tfm>/
~/.nuget/packages/newtonsoft.json/13.0.3/lib/netstandard2.0/Newtonsoft.Json.dll
~/.nuget/packages/microsoft.extensions.dependencyinjection/8.0.0/lib/net8.0/Microsoft.Extensions.DependencyInjection.dll
.NET Runtime Libraries
dotnet --list-runtimes
C:/Program Files/dotnet/shared/Microsoft.NETCore.App/<version>/
C:/Program Files/dotnet/shared/Microsoft.AspNetCore.App/<version>/
/usr/share/dotnet/shared/Microsoft.NETCore.App/<version>/
/usr/share/dotnet/shared/Microsoft.AspNetCore.App/<version>/
C:/Program Files/dotnet/shared/Microsoft.NETCore.App/8.0.0/System.Text.Json.dll
.NET SDK Reference Assemblies
dotnet --list-sdks
C:/Program Files/dotnet/packs/Microsoft.NETCore.App.Ref/<version>/ref/net8.0/
Project Build Output
./bin/Debug/net8.0/<AssemblyName>.dll
./bin/Release/net8.0/publish/<AssemblyName>.dll
Core workflow
- Identify what you want to understand (API, class, method)
- Locate the assembly containing that code
- Use
dnx ilspycmd -l class to find the exact type name
- Decompile the specific type with
-t
Commands
Basic Decompilation
dnx ilspycmd MyLibrary.dll
dnx ilspycmd -o ./decompiled MyLibrary.dll
dnx ilspycmd -p -o ./project MyLibrary.dll
dnx ilspycmd -p -o ./project --nested-directories MyLibrary.dll
Targeted Decompilation
dnx ilspycmd -t Namespace.ClassName MyLibrary.dll
dnx ilspycmd -lv CSharp12_0 MyLibrary.dll
dnx ilspycmd -r ./dependencies MyLibrary.dll
View IL Code
dnx ilspycmd -il MyLibrary.dll
dnx ilspycmd -il -t Namespace.ClassName MyLibrary.dll
List Types
dnx ilspycmd -l class MyLibrary.dll
dnx ilspycmd -l interface MyLibrary.dll
dnx ilspycmd -l struct MyLibrary.dll
dnx ilspycmd -l enum MyLibrary.dll
dnx ilspycmd -l delegate MyLibrary.dll
Options
dnx ilspycmd -h
dnx ilspycmd --disable-updatecheck MyLibrary.dll
dnx ilspycmd --no-dead-code MyLibrary.dll
Example: Understand how JsonSerializer works
dotnet --list-runtimes
dnx ilspycmd -l class "C:/Program Files/dotnet/shared/Microsoft.NETCore.App/8.0.0/System.Text.Json.dll"
dnx ilspycmd -t System.Text.Json.JsonSerializer "C:/Program Files/dotnet/shared/Microsoft.NETCore.App/8.0.0/System.Text.Json.dll"
Example: Inspect a NuGet package implementation
dnx ilspycmd -t Polly.Retry.RetryPolicy ~/.nuget/packages/polly/8.0.0/lib/netstandard2.0/Polly.dll
dnx ilspycmd -p -o ./polly-src ~/.nuget/packages/polly/8.0.0/lib/netstandard2.0/Polly.dll
Example: See how ASP.NET Core handles requests
dnx ilspycmd -l class "C:/Program Files/dotnet/shared/Microsoft.AspNetCore.App/8.0.0/Microsoft.AspNetCore.Server.Kestrel.Core.dll"
dnx ilspycmd -t Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer "C:/Program Files/dotnet/shared/Microsoft.AspNetCore.App/8.0.0/Microsoft.AspNetCore.Server.Kestrel.Core.dll"
Example: Compare C# and IL
dnx ilspycmd -t MyNamespace.MyClass MyLibrary.dll
dnx ilspycmd -il -t MyNamespace.MyClass MyLibrary.dll
C# Language Versions
Available versions for -lv option:
- CSharp1 through CSharp12_0
- Latest, Preview