dotnet-inspect
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesedotnet-inspect
dotnet-inspect
Query .NET library APIs — the same commands work across NuGet packages, platform libraries (System., Microsoft.AspNetCore.), and local .dll/.nupkg files.
跨NuGet包、平台库(System.、Microsoft.AspNetCore.)和本地.dll/.nupkg文件查询.NET库API —— 相同的命令可在所有场景下使用。
When to Use This Skill
何时使用该工具
- "What types are in this package?" — searches by glob pattern
find - "What's the API surface?" — lists types, members, signatures, type shape
api - "What changed between versions?" — classifies breaking/additive changes
diff - "What extends this type?" — finds extension methods/properties
extensions - "What implements this interface?" — finds concrete types
implements - "What version/metadata does this have?" — and
packageinspect metadatalibrary
- “此包中有哪些类型?” —— 使用命令通过通配符模式搜索
find - “API接口是什么?” —— 命令列出类型、成员、签名、类型结构
api - “不同版本之间有哪些变化?” —— 命令分类显示破坏性/新增变化
diff - “哪些内容扩展了该类型?” —— 命令查找扩展方法/属性
extensions - “哪些类型实现了该接口?” —— 命令查找具体类型
implements - “它的版本/元数据是什么?” —— 和
package命令检查元数据library
Search Scope
搜索范围
Search commands (, , ) work across all of .NET:
findextensionsimplementsbash
dnx dotnet-inspect -y -- find "Chat*" # default scope (platform + curated)
dnx dotnet-inspect -y -- find "Chat*" --platform # platform frameworks only
dnx dotnet-inspect -y -- find "Chat*" --extensions # Microsoft.Extensions.* packages
dnx dotnet-inspect -y -- find "Chat*" --aspnetcore # Microsoft.AspNetCore.* packages
dnx dotnet-inspect -y -- find "Chat*" --platform --extensions # combine scopes
dnx dotnet-inspect -y -- find "Chat*" --package Foo # specific NuGet package
dnx dotnet-inspect -y -- find "Chat*" --platform --package Foo # platform + a specific packageScope flags are combinable — use multiple flags to widen the search. works on all commands. , , also accept for a specific platform library.
--packageapilibrarydiff--platform <name>搜索命令(、、)可在整个.NET生态中使用:
findextensionsimplementsbash
dnx dotnet-inspect -y -- find "Chat*" # 默认范围(平台+精选库)
dnx dotnet-inspect -y -- find "Chat*" --platform # 仅平台框架
dnx dotnet-inspect -y -- find "Chat*" --extensions # 仅Microsoft.Extensions.*包
dnx dotnet-inspect -y -- find "Chat*" --aspnetcore # 仅Microsoft.AspNetCore.*包
dnx dotnet-inspect -y -- find "Chat*" --platform --extensions # 组合范围
dnx dotnet-inspect -y -- find "Chat*" --package Foo # 指定NuGet包
dnx dotnet-inspect -y -- find "Chat*" --platform --package Foo # 平台+指定包范围标志可组合使用——使用多个标志扩大搜索范围。适用于所有命令。、、命令也支持来指定具体的平台库。
--packageapilibrarydiff--platform <name>Examples by Task
按任务分类的示例
List API surface
列出API接口
bash
dnx dotnet-inspect -y -- api System.Text.Json # all types in library
dnx dotnet-inspect -y -- api System.Text.Json JsonSerializer # members of a type
dnx dotnet-inspect -y -- api 'HashSet<T>' --platform System.Collections --shape # type shape diagram
dnx dotnet-inspect -y -- api JsonSerializer --package System.Text.Json -m Serialize # filter to memberbash
dnx dotnet-inspect -y -- api System.Text.Json # 库中的所有类型
dnx dotnet-inspect -y -- api System.Text.Json JsonSerializer # 类型的成员
dnx dotnet-inspect -y -- api 'HashSet<T>' --platform System.Collections --shape # 类型结构示意图
dnx dotnet-inspect -y -- api JsonSerializer --package System.Text.Json -m Serialize # 筛选成员Search for types
搜索类型
bash
dnx dotnet-inspect -y -- find "*Handler*" --package System.CommandLine
dnx dotnet-inspect -y -- find "Option*,Argument*,Command*" --package System.CommandLine --terse
dnx dotnet-inspect -y -- find "*Logger*"bash
dnx dotnet-inspect -y -- find "*Handler*" --package System.CommandLine
dnx dotnet-inspect -y -- find "Option*,Argument*,Command*" --package System.CommandLine --terse
dnx dotnet-inspect -y -- find "*Logger*"Compare versions (migrations)
比较版本(迁移场景)
bash
dnx dotnet-inspect -y -- diff --package System.CommandLine@2.0.0-beta4.22272.1..2.0.2
dnx dotnet-inspect -y -- diff --package System.Text.Json@9.0.0..10.0.0 --breaking
dnx dotnet-inspect -y -- diff JsonSerializer --package System.Text.Json@9.0.0..10.0.0bash
dnx dotnet-inspect -y -- diff --package System.CommandLine@2.0.0-beta4.22272.1..2.0.2
dnx dotnet-inspect -y -- diff --package System.Text.Json@9.0.0..10.0.0 --breaking
dnx dotnet-inspect -y -- diff JsonSerializer --package System.Text.Json@9.0.0..10.0.0Find extensions and implementors
查找扩展和实现类
bash
dnx dotnet-inspect -y -- extensions HttpClient # what extends HttpClient?
dnx dotnet-inspect -y -- extensions IServiceCollection # across default scope
dnx dotnet-inspect -y -- implements Stream # what extends Stream?
dnx dotnet-inspect -y -- implements IDisposable --platform # across all platform frameworksbash
dnx dotnet-inspect -y -- extensions HttpClient # 哪些内容扩展了HttpClient?
dnx dotnet-inspect -y -- extensions IServiceCollection # 在默认范围内查找
dnx dotnet-inspect -y -- implements Stream # 哪些类型继承自Stream?
dnx dotnet-inspect -y -- implements IDisposable --platform # 在所有平台框架中查找Inspect packages and libraries
检查包和库
bash
dnx dotnet-inspect -y -- package System.Text.Json # metadata, latest version
dnx dotnet-inspect -y -- package System.Text.Json --versions # available versions
dnx dotnet-inspect -y -- library System.Text.Json # library metadata, symbols
dnx dotnet-inspect -y -- library ./bin/MyLib.dll # local filebash
dnx dotnet-inspect -y -- package System.Text.Json # 元数据、最新版本
dnx dotnet-inspect -y -- package System.Text.Json --versions # 可用版本
dnx dotnet-inspect -y -- library System.Text.Json # 库元数据、符号
dnx dotnet-inspect -y -- library ./bin/MyLib.dll # 本地文件Command Reference
命令参考
| Command | Purpose |
|---|---|
| Public API surface — types, members, signatures, |
| Search for types by glob pattern across any scope |
| Compare API surfaces between versions — breaking/additive classification |
| Find extension methods/properties for a type |
| Find types implementing an interface or extending a base class |
| Package metadata, files, versions, dependencies |
| Library metadata, symbols, references, dependencies |
| 命令 | 用途 |
|---|---|
| 公共API接口 —— 类型、成员、签名, |
| 跨任意范围通过通配符模式搜索类型 |
| 比较不同版本间的API接口 —— 分类显示破坏性/新增变化 |
| 查找类型的扩展方法/属性 |
| 查找实现接口或继承基类的类型 |
| 包元数据、文件、版本、依赖项 |
| 库元数据、符号、引用、依赖项 |
Key Syntax
关键语法
- Generic types need quotes: ,
'Option<T>''IEnumerable<T>' - Positional args for :
api(not flags)api <source> <type> <member> - Diff ranges use :
..--package System.Text.Json@9.0.0..10.0.0 - Signatures include and default values from metadata
params
- 泛型类型需要加引号:、
'Option<T>''IEnumerable<T>' - api命令的位置参数:(非标志参数)
api <源> <类型> <成员> - 版本对比范围使用:
..--package System.Text.Json@9.0.0..10.0.0 - 签名包含元数据中的和默认值
params
Installation
安装
Use (like ). Always use and to prevent interactive prompts:
dnxnpx-y--bash
dnx dotnet-inspect -y -- <command>使用(类似)。请始终使用和以避免交互式提示:
dnxnpx-y--bash
dnx dotnet-inspect -y -- <command>Full Documentation
完整文档
For comprehensive syntax, edge cases, and the flag compatibility matrix:
bash
dnx dotnet-inspect -y -- llmstxt如需了解全面的语法、边缘情况和标志兼容性矩阵:
bash
dnx dotnet-inspect -y -- llmstxt