Community程式設計與開發github.com

ilspy-decompile

透過反編譯 .NET 組件來了解實作細節。當你想查看 .NET API 的內部運作、檢查 NuGet 套件原始碼、檢視框架實作,或理解已編譯的 .NET 二進位檔時使用。

ilspy-decompile 是什麼?

這個技能讓你使用 ILSpy 命令列工具反編譯 .NET 組件,以了解內部實作細節。它對需要查看 .NET API 內部運作、檢查 NuGet 套件原始碼、檢視框架實作或理解已編譯 .NET 二進位檔的開發人員非常有用。該技能支援透過 `ilspycmd` 或 `dnx ilspycmd` 使用 ILSpy,並涵蓋常見的組件位置,包括 NuGet 套件、.NET 執行階段程式庫、SDK 參考組件以及專案建置輸出。工作流程包括識別目標、定位組件、列出類型以及進行反編譯。提供的指令涵蓋基本反編譯、將輸出寫入資料夾、建立專案檔案、針對特定類型進行反編譯、指定語言版本,以及檢視 IL 程式碼。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Aaronontheweb/dotnet-skills/tree/main/skills/ilspy-decompile

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

使用 ILSpy 進行 .NET 組件反編譯

使用此技能來了解 .NET 程式碼的內部運作方式,透過反編譯已編譯的組件。

先決條件

  • 已安裝 .NET SDK
  • 可透過以下其中一種方式取得 ILSpy 命令列工具:
    • dnx ilspycmd(如果您的 SDK 或執行階段中有提供)
    • dotnet tool install --global ilspycmd

以下顯示兩種形式。請使用在您環境中可運作的方式。

注意:ILSpyCmd 的選項可能因版本而略有不同。
請務必使用 ilspycmd -h 驗證支援的旗標。

快速開始

# 將組件反編譯到標準輸出
ilspycmd MyLibrary.dll
# 或
dnx ilspycmd MyLibrary.dll

# 反編譯到輸出資料夾
ilspycmd -o output-folder MyLibrary.dll

常見的 .NET 組件位置

NuGet 套件

~/.nuget/packages/<package-name>/<version>/lib/<tfm>/

.NET 執行階段程式庫

dotnet --list-runtimes

.NET SDK 參考組件

dotnet --list-sdks

參考組件不包含實作。

專案建置輸出

./bin/Debug/net8.0/<AssemblyName>.dll
./bin/Release/net8.0/publish/<AssemblyName>.dll

核心工作流程

  1. 識別您想要了解的目標
  2. 定位組件
  3. 列出類型
  4. 反編譯目標

指令

基本反編譯

ilspycmd MyLibrary.dll
ilspycmd -o ./decompiled MyLibrary.dll
ilspycmd -p -o ./project MyLibrary.dll

針對性反編譯

ilspycmd -t Namespace.ClassName MyLibrary.dll
ilspycmd -lv CSharp12_0 MyLibrary.dll

檢視 IL 程式碼

ilspycmd -il MyLibrary.dll

關於現代 .NET 建置的備註

  • ReadyToRun 映像可能會降低可讀性
  • 修剪或 AOT 建置可能會省略程式碼
  • 偏好使用非修剪建置

法律備註

反編譯組件可能受到授權限制。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

akka-hosting-actor-patterns

Patterns for building entity actors with Akka.Hosting - GenericChildPerEntityParent, message extractors, cluster sharding abstraction, akka-reminders, and ITimeProvider. Supports both local testing and clustered production modes.

akka-net-aspire-configuration

Configure Akka.NET with .NET Aspire for local development and production deployments. Covers actor system setup, clustering, persistence, Akka.Management integration, and Aspire orchestration patterns.

akka-net-best-practices

Critical 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.

akka-net-management

Akka.Management for cluster bootstrapping, service discovery (Kubernetes, Azure, Config), health checks, and dynamic cluster formation without static seed nodes.

akka-net-testing-patterns

Write unit and integration tests for Akka.NET actors using modern Akka.Hosting.TestKit patterns. Covers dependency injection, TestProbes, persistence testing, and actor interaction verification. Includes guidance on when to use traditional TestKit.

api-design

Design stable, compatible public APIs using extend-only design principles. Manage API compatibility, wire compatibility, and versioning for NuGet packages and distributed systems.

aspire-configuration

Configure Aspire AppHost to emit explicit app config via environment variables; keep app code free of Aspire clients and service discovery.

aspire-integration-testing

Write integration tests using .NET Aspire

aspire-service-defaults

Create a shared ServiceDefaults project for Aspire applications. Centralizes OpenTelemetry, health checks, resilience, and service discovery configuration across all services.

crap-analysis

Analyze code coverage and CRAP (Change Risk Anti-Patterns) scores to identify high-risk code. Use OpenCover format with ReportGenerator for Risk Hotspots showing cyclomatic complexity and untested code paths.

csharp-concurrency-patterns

Choosing 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.

database-performance

Database access patterns for performance. Separate read/write models, avoid N+1 queries, use AsNoTracking, apply row limits, and never do application-side joins. Works with EF Core and Dapper.

dependency-injection-patterns

Organize DI registrations using IServiceCollection extension methods. Group related services into composable Add* methods for clean Program.cs and reusable configuration in tests.

dotnet-devcert-trust

Diagnose and fix .NET HTTPS dev certificate trust issues on Linux. Covers the full certificate lifecycle from generation to system CA bundle inclusion, with distro-specific guidance for Ubuntu, Fedora, Arch, and WSL2.

dotnet-local-tools

Managing local .NET tools with dotnet-tools.json for consistent tooling across development environments and CI/CD pipelines.

dotnet-project-structure

Modern .NET project structure including .slnx solution format, Directory.Build.props, central package management, SourceLink, version management with RELEASE_NOTES.md, and SDK pinning with global.json.

dotnet-slopwatch

Use Slopwatch to detect LLM reward hacking in .NET code changes. Run after every code modification to catch disabled tests, suppressed warnings, empty catch blocks, and other shortcuts that mask real problems.

efcore-patterns

Entity Framework Core best practices including NoTracking by default, query splitting for navigation collections, migration management, dedicated migration services, and common pitfalls to avoid.

mailpit-integration

Test email sending locally using Mailpit with .NET Aspire. Captures all outgoing emails without sending them. View rendered HTML, inspect headers, and verify delivery in integration tests.

marketplace-publishing

Workflow for publishing skills and agents to the dotnet-skills Claude Code marketplace. Covers adding new content, updating plugin.json, validation, and release tagging.

相關技能