反编译
- 作者仓库星标 0
- 作者更新于 2026年8月7日 18:11
- 作者仓库 dotnet-skills
- 领域
- 通用
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @Aaronontheweb · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
# Decompile an assembly to stdout
ilspycmd MyLibrary.dll
# or
dnx ilspycmd MyLibrary.dll
# Decompile to an output folder
ilspycmd -o output-folder MyLibrary.dll
# .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 with `ilspycmd -h`.
## Quick start
```bash
# 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
```bash
~/.nuget/packages/<package-name>/<version>/lib/<tfm>/
```
### .NET runtime libraries
```bash
dotnet --list-runtimes
```
### .NET SDK reference assemblies
```bash
dotnet --list-sdks
```
> Reference assemblies do not contain implementations.
### Project build output
```bash
./bin/Debug/net8.0/<AssemblyName>.dll
./bin/Release/net8.0/publish/<AssemblyName>.dll
```
## Core workflow
1. Identify what you want to understand
2. Locate the assembly
3. List types
4. Decompile the target
## Commands
### Basic decompilation
```bash
ilspycmd MyLibrary.dll
ilspycmd -o ./decompiled MyLibrary.dll
ilspycmd -p -o ./project MyLibrary.dll
```
### Targeted decompilation
```bash
ilspycmd -t Namespace.ClassName MyLibrary.dll
ilspycmd -lv CSharp12_0 MyLibrary.dll
```
### View IL code
```bash
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.
章节与文件索引
按说明文件中的顺序排列。
先决条件
.NET SDK 参考程序集
核心工作流程
现代 .NET 构建的注释
法律说明
文件/命令 -> dnx ilspycmd · dotnet tool install --global ilspycmd · ilspycmd -h · .nuget/packages · ./bin/Debug/net8.0 · ./bin/Release/net8.0/publish · ./decompiled · ./project
内容校验值 -> 4bc1d39fb442
当前原文的自动摘译,尚未人工审校。
先决条件
.NET SDK 安装的 ILSpy 命令行工具可通过以下方式之一使用:
dnx ilspycmd(如果在您的 SDK 或运行时中可用)dotnet tool install --global ilspycmd两种形式如下所示。使用适合您环境的那个。.NET SDK 参考程序集
参考程序集不包含实现。
核心工作流程
确定您想要了解的内容 定位程序集 列出类型 反编译目标
现代 .NET 构建的注释
ReadyToRun 图像可能会降低可读性 修剪或 AOT 构建可能会省略代码 首选非修剪构建
法律说明
反编译程序集可能会受到许可证限制。