npx skills add https://github.com/carsten-j/agent-resources --skill ilspy-decompile使用此技能通过反编译已编译的程序集来理解 .NET 代码的内部工作原理。
# 将程序集反编译到标准输出(.NET 10+ 无需安装)
dnx ilspycmd MyLibrary.dll
# 反编译到输出文件夹
dnx ilspycmd -o output-folder MyLibrary.dll
# Windows
~/.nuget/packages/<package-name>/<version>/lib/<tfm>/
# 示例:Newtonsoft.Json
~/.nuget/packages/newtonsoft.json/13.0.3/lib/netstandard2.0/Newtonsoft.Json.dll
# 示例:Microsoft.Extensions.DependencyInjection
~/.nuget/packages/microsoft.extensions.dependencyinjection/8.0.0/lib/net8.0/Microsoft.Extensions.DependencyInjection.dll
# 查找 .NET 安装位置
dotnet --list-runtimes
# Windows 典型路径
C:/Program Files/dotnet/shared/Microsoft.NETCore.App/<version>/
C:/Program Files/dotnet/shared/Microsoft.AspNetCore.App/<version>/
# Linux/macOS 典型路径
/usr/share/dotnet/shared/Microsoft.NETCore.App/<version>/
/usr/share/dotnet/shared/Microsoft.AspNetCore.App/<version>/
# 示例:来自运行时的 System.Text.Json
C:/Program Files/dotnet/shared/Microsoft.NETCore.App/8.0.0/System.Text.Json.dll
Use this skill to understand how .NET code works internally by decompiling compiled assemblies.
# Decompile an assembly to stdout (no install needed with .NET 10+)
dnx ilspycmd MyLibrary.dll
# Decompile to an output folder
dnx ilspycmd -o output-folder MyLibrary.dll
# Windows
~/.nuget/packages/<package-name>/<version>/lib/<tfm>/
# Example: Newtonsoft.Json
~/.nuget/packages/newtonsoft.json/13.0.3/lib/netstandard2.0/Newtonsoft.Json.dll
# Example: Microsoft.Extensions.DependencyInjection
~/.nuget/packages/microsoft.extensions.dependencyinjection/8.0.0/lib/net8.0/Microsoft.Extensions.DependencyInjection.dll
# Find .NET install location
dotnet --list-runtimes
# Windows typical paths
C:/Program Files/dotnet/shared/Microsoft.NETCore.App/<version>/
C:/Program Files/dotnet/shared/Microsoft.AspNetCore.App/<version>/
# Linux/macOS typical paths
/usr/share/dotnet/shared/Microsoft.NETCore.App/<version>/
/usr/share/dotnet/shared/Microsoft.AspNetCore.App/<version>/
# Example: System.Text.Json from runtime
C:/Program Files/dotnet/shared/Microsoft.NETCore.App/8.0.0/System.Text.Json.dll
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# 查找 SDK 位置
dotnet --list-sdks
# 引用程序集(设计时外观)
C:/Program Files/dotnet/packs/Microsoft.NETCore.App.Ref/<version>/ref/net8.0/
# 调试构建
./bin/Debug/net8.0/<AssemblyName>.dll
# 发布输出
./bin/Release/net8.0/publish/<AssemblyName>.dll
dnx ilspycmd -l class 查找确切的类型名称-t 反编译特定类型# 反编译到标准输出
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
# 反编译特定类型
dnx ilspycmd -t Namespace.ClassName MyLibrary.dll
# 使用特定 C# 版本反编译
dnx ilspycmd -lv CSharp12_0 MyLibrary.dll
# 使用依赖项的引用路径进行反编译
dnx ilspycmd -r ./dependencies MyLibrary.dll
# 显示 IL 代码而非 C#
dnx ilspycmd -il MyLibrary.dll
# 显示特定类型的 IL
dnx ilspycmd -il -t Namespace.ClassName MyLibrary.dll
# 列出所有类
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
# 显示帮助
dnx ilspycmd -h
# 禁用更新检查(适用于 CI/自动化)
dnx ilspycmd --disable-updatecheck MyLibrary.dll
# 移除死代码
dnx ilspycmd --no-dead-code MyLibrary.dll
# 在运行时中查找 System.Text.Json
dotnet --list-runtimes
# Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
# 列出类以查找 JsonSerializer
dnx ilspycmd -l class "C:/Program Files/dotnet/shared/Microsoft.NETCore.App/8.0.0/System.Text.Json.dll"
# 反编译 JsonSerializer
dnx ilspycmd -t System.Text.Json.JsonSerializer "C:/Program Files/dotnet/shared/Microsoft.NETCore.App/8.0.0/System.Text.Json.dll"
# 反编译 Polly 的重试逻辑
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
# 查找 ASP.NET Core 运行时
# C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\8.0.0\
# 反编译 Kestrel 服务器
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"
# 查看 C# 源代码
dnx ilspycmd -t MyNamespace.MyClass MyLibrary.dll
# 查看相同类型的 IL 代码
dnx ilspycmd -il -t MyNamespace.MyClass MyLibrary.dll
-lv 选项的可用版本:
每周安装数
1
仓库
首次出现
今日
安全审计
安装于
zencoder1
amp1
cline1
openclaw1
opencode1
cursor1
# Find SDK location
dotnet --list-sdks
# Reference assemblies (design-time facades)
C:/Program Files/dotnet/packs/Microsoft.NETCore.App.Ref/<version>/ref/net8.0/
# Debug build
./bin/Debug/net8.0/<AssemblyName>.dll
# Published output
./bin/Release/net8.0/publish/<AssemblyName>.dll
dnx ilspycmd -l class to find the exact type name-t# Decompile to stdout
dnx ilspycmd MyLibrary.dll
# Decompile to output directory
dnx ilspycmd -o ./decompiled MyLibrary.dll
# Decompile as compilable project
dnx ilspycmd -p -o ./project MyLibrary.dll
# Decompile with nested namespace folders
dnx ilspycmd -p -o ./project --nested-directories MyLibrary.dll
# Decompile a specific type
dnx ilspycmd -t Namespace.ClassName MyLibrary.dll
# Decompile with specific C# version
dnx ilspycmd -lv CSharp12_0 MyLibrary.dll
# Decompile with reference path for dependencies
dnx ilspycmd -r ./dependencies MyLibrary.dll
# Show IL code instead of C#
dnx ilspycmd -il MyLibrary.dll
# Show IL for specific type
dnx ilspycmd -il -t Namespace.ClassName MyLibrary.dll
# List all classes
dnx ilspycmd -l class MyLibrary.dll
# List interfaces
dnx ilspycmd -l interface MyLibrary.dll
# List structs
dnx ilspycmd -l struct MyLibrary.dll
# List enums
dnx ilspycmd -l enum MyLibrary.dll
# List delegates
dnx ilspycmd -l delegate MyLibrary.dll
# Show help
dnx ilspycmd -h
# Disable update check (useful for CI/automation)
dnx ilspycmd --disable-updatecheck MyLibrary.dll
# Remove dead code
dnx ilspycmd --no-dead-code MyLibrary.dll
# Find System.Text.Json in the runtime
dotnet --list-runtimes
# Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
# List classes to find JsonSerializer
dnx ilspycmd -l class "C:/Program Files/dotnet/shared/Microsoft.NETCore.App/8.0.0/System.Text.Json.dll"
# Decompile JsonSerializer
dnx ilspycmd -t System.Text.Json.JsonSerializer "C:/Program Files/dotnet/shared/Microsoft.NETCore.App/8.0.0/System.Text.Json.dll"
# Decompile Polly's retry logic
dnx ilspycmd -t Polly.Retry.RetryPolicy ~/.nuget/packages/polly/8.0.0/lib/netstandard2.0/Polly.dll
# Decompile entire package to project for exploration
dnx ilspycmd -p -o ./polly-src ~/.nuget/packages/polly/8.0.0/lib/netstandard2.0/Polly.dll
# Find the ASP.NET Core runtime
# C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\8.0.0\
# Decompile the Kestrel server
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"
# View C# source
dnx ilspycmd -t MyNamespace.MyClass MyLibrary.dll
# View IL code for same type
dnx ilspycmd -il -t MyNamespace.MyClass MyLibrary.dll
Available versions for -lv option:
Weekly Installs
1
Repository
First Seen
Today
Security Audits
Installed on
zencoder1
amp1
cline1
openclaw1
opencode1
cursor1
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
109,600 周安装