‹ 首页

dotnet-dependency

@nikiforovall · 收录于 昨天 · 上游提交 3 周前

This skill should be used when investigating .NET project dependencies, understanding why packages are included, listing references, or auditing for outdated/vulnerable packages.

适合你,如果经常需要理清或审计.NET项目的依赖关系。

/ 通过 npx 安装 校验哈希
npx oh-my-skill add nikiforovall/claude-code-rules/dotnet-dependency
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- nikiforovall/claude-code-rules/dotnet-dependency
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify nikiforovall/claude-code-rules/dotnet-dependency
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
133GitHub stars
~1.3K最小装载
~1.9K含声明引用
~1.9K文本包总量
索引托管

怎么用

商店整理自技能原文 · 版本 642e21e · 表述以原文为准
它做什么

安装后,Claude 能通过 dotnet CLI 命令管理和调查 .NET 项目的依赖。它可以搜索 NuGet 包、添加/更新/移除包引用、列出所有依赖(包括传递依赖)、查找过时或有漏洞的包、分析某个包的包含原因、管理 dotnet 工具(搜索、更新)等。

什么时候触发

当用户需要处理 .NET 项目的依赖时触发,例如搜索包、添加/删除引用、找出某个包的来源、列出所有引用、检查过时或有漏洞的包、管理 dotnet 工具等。

装好后可以这样说
技能原文 SKILL.md作者撰写 · Apache-2.0 · 642e21e

.NET Dependencies

Investigate and manage .NET project dependencies using built-in dotnet CLI commands.

When to Use This Skill

Invoke when the user needs to:

  • Search for NuGet packages or find latest versions
  • Add, update, or remove package references
  • Understand why a specific NuGet package is included
  • List all project dependencies (NuGet packages or project references)
  • Find outdated or vulnerable packages
  • Trace transitive dependencies
  • Manage dotnet tools (search, install, update)
Quick Reference

| Command | Purpose | | ------------------------------------------- | -------------------------------------- | | dotnet package search <term> | Search NuGet for packages | | dotnet package search <name> --exact-match| List all versions of a package | | dotnet add package <id> | Add/update package to latest version | | dotnet add package <id> -v <ver> | Add/update package to specific version | | dotnet remove package <id> | Remove package reference | | dotnet nuget why <package> | Show dependency graph for a package | | dotnet list package | List NuGet packages | | dotnet list package --include-transitive | Include transitive dependencies | | dotnet list reference --project <project> | List project-to-project references | | dotnet list package --outdated | Find packages with newer versions | | dotnet list package --vulnerable | Find packages with security issues | | dotnet outdated | (Third-party) Check outdated packages | | dotnet outdated -u | (Third-party) Auto-update packages | | dotnet tool search <term> | Search for dotnet tools | | dotnet tool update <id> | Update local tool to latest | | dotnet tool update --all | Update all local tools |

Search NuGet Packages

Find packages and check latest versions directly from CLI:

# Search for packages by keyword
dotnet package search Serilog --take 5

# Find latest version of a specific package
dotnet package search Aspire.Hosting.AppHost --take 1

# Include prerelease versions
dotnet package search ModelContextProtocol --prerelease --take 3

# List ALL available versions of a package (version history)
dotnet package search Newtonsoft.Json --exact-match

# JSON output for scripting
dotnet package search Serilog --format json --take 3
Add and Update Packages
# Add package (installs latest stable version)
dotnet add package Serilog

# Add specific version
dotnet add package Serilog -v 4.0.0

# Add prerelease version
dotnet add package ModelContextProtocol --prerelease

# Add to specific project
dotnet add src/MyProject/MyProject.csproj package Serilog

# Update existing package to latest (same command as add)
dotnet add package Serilog

# Remove package
dotnet remove package Serilog

Note: dotnet add package both adds new packages and updates existing ones to the specified (or latest) version.

Manage Dotnet Tools
# Search for tools
dotnet tool search dotnet-outdated --take 3

# Update a local tool (from manifest)
dotnet tool update cake.tool

# Update with prerelease
dotnet tool update aspire.cli --prerelease

# Update all local tools
dotnet tool update --all

# Update global tool
dotnet tool update -g dotnet-ef
Investigate Package Dependencies

To understand why a package is included in your project:

# Why is this package included?
dotnet nuget why Newtonsoft.Json

# For a specific project
dotnet nuget why path/to/Project.csproj Newtonsoft.Json

# For a specific framework
dotnet nuget why Newtonsoft.Json --framework net8.0

Output shows the complete dependency chain from your project to the package.

List NuGet Packages
# Direct dependencies only
dotnet list package

# Include transitive (indirect) dependencies
dotnet list package --include-transitive

# For a specific project
dotnet list package --project path/to/Project.csproj

# JSON output for scripting
dotnet list package --format json
List Project References
# List project-to-project references
dotnet list reference --project path/to/Project.csproj
Transitive Project References

No built-in command shows transitive project dependencies. To find if Project A depends on Project B transitively:

  1. Recursive approach: Run dotnet list reference on each referenced project
  2. Parse .csproj files: Search for <ProjectReference> elements recursively:
# Find all ProjectReference elements
grep -r "ProjectReference" --include="*.csproj" .
Update Dependencies
Using dotnet outdated (Third-party)

If installed (dotnet tool install -g dotnet-outdated-tool):

# Check for outdated packages
dotnet outdated

# Auto-update to latest versions
dotnet outdated -u

# Update only specific packages
dotnet outdated -u -inc PackageName
Using built-in commands
# Check for outdated packages
dotnet list package --outdated

# Include prerelease versions
dotnet list package --outdated --include-prerelease
Progressive Disclosure

For security auditing (vulnerable, deprecated, outdated packages), load references/security-audit.md.

References
按 Apache-2.0 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。