Token导航 LogoToken导航TokenDH.com
待分类需要联网github未标认证来源可访问许可证需确认审计通过

dotnet-version-detectiondotnet 版本检测

Agent Skill

dotnet-version-detection 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

371

周安装

15

GitHub Stars

15

下载量

116
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:dotnet-version-detection(dotnet 版本检测)
来源仓库:https://github.com/wshaddix/dotnet-skills
仓库路径:skills/dotnet-version-detection
安装命令:
npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-version-detection
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-version-detection

简介

自动检测 .NET 项目的版本信息。

  • 从项目文件解析 TFM 和 SDK 版本。
  • 为其他技能提供版本适配的基础数据。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。
  • 适用于升级前环境状态识别与依赖判断。
  • dotnet-version-detection 属于待分类类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

dotnet-version-detection

Detects.NET version information from project files and provides version-specific guidance. This skill runs first before any.NET development work. All other skills depend on the detected version to adapt their guidance.

Cross-cutting skill referenced by [skill:dotnet-advisor] and virtually all specialist skills. See also [skill:dotnet-file-based-apps] for.NET 10+ file-based apps that run without a .csproj.


Detection Precedence Algorithm

Read project files in this strict order. Higher-numbered sources are lower priority. Stop falling through once a TFM is resolved.

1. Direct <TargetFramework> in.csproj (highest priority)

Read the nearest .csproj file to the current working file/directory.

<PropertyGroup>
  <TargetFramework>net10.0</TargetFramework>
</PropertyGroup>

If found and the value is a literal TFM (e.g., net10.0, not $(SomeProperty)), this is the authoritative TFM. Report it and proceed to additional detection (Step 5).

If the value is an MSBuild property expression (starts with $(), skip to Step 4 for unresolved property handling.

2. <TargetFrameworks> in.csproj (multi-targeting)

<PropertyGroup>
  <TargetFrameworks>net8.0;net10.0</TargetFrameworks>
</PropertyGroup>

If found:

  • Report all TFMs (semicolon-delimited)
  • Guide based on the highest TFM (e.g., net10.0)
  • Note polyfill needs for lower TFMs: "Consider [skill:dotnet-multi-targeting] for PolySharp/Polyfill to backport language features to net8.0"
  • Proceed to additional detection (Step 5)

3. Directory.Build.props shared TFM

If no <TargetFramework> or <TargetFrameworks> found in the.csproj (or if the.csproj inherits from shared props), read Directory.Build.props in the current directory or any parent directory up to the solution root.

<!-- Directory.Build.props -->
<PropertyGroup>
  <TargetFramework>net10.0</TargetFramework>
</PropertyGroup>

If found, use this as the TFM. Note: per-project .csproj values override Directory.Build.props.

4. MSBuild Property Expressions (fallback with warning)

If the TFM value is an MSBuild property expression rather than a literal:

<TargetFramework>$(MyCustomTfm)</TargetFramework>

Emit warning:

Warning: Unresolved MSBuild property $(MyCustomTfm). Cannot determine TFM statically. Falling back to SDK version from global.json.

Then fall through to global.json SDK version (Step 4a) or dotnet --version (Step 4b).

4a. global.json SDK version

{
  "sdk": {
    "version": "10.0.100"
  }
}

Map SDK version to approximate TFM:

  • 8.0.xxx -> net8.0
  • 9.0.xxx -> net9.0
  • 10.0.xxx -> net10.0
  • 11.0.xxx-preview.x -> net11.0

Report: "Inferred TFM from global.json SDK version. Verify actual TFM in project file."

4b. dotnet --version (last resort)

If no global.json exists, use dotnet --version output to infer SDK version. Same mapping as 4a.

Report: "Inferred TFM from installed SDK version. No global.json or .csproj found. Consider creating a project with dotnet new."


Additional Detection (Step 5)

After resolving the TFM, also check these files for supplementary version information. Always perform these checks regardless of which precedence step resolved the TFM.

5a. global.json SDK Version

Even if TFM was resolved from.csproj, read global.json for:

  • sdk.version -- the pinned SDK version
  • sdk.rollForward -- the rollForward policy (e.g., latestFeature, latestPatch)

Report the SDK version alongside the TFM. Flag inconsistencies:

Warning: TFM net10.0 but global.json pins SDK 9.0.100. The project targets a newer framework than the pinned SDK. Update global.json or verify the build environment has the correct SDK.

5b. C# Language Version

Check for explicit <LangVersion> in.csproj or Directory.Build.props:

<LangVersion>preview</LangVersion>
  • If preview -- report "C# preview features enabled. Unlocks the next C# version available in the installed SDK (e.g., C# 15 preview features with a.NET 11 preview SDK)."
  • If latest -- report the default C# version for the detected TFM
  • If explicit version (e.g., 12.0) -- report that version, warn if it's below the TFM default
  • If absent -- use the default C# version for the TFM (see reference data below)

5c. Preview Feature Detection

Check for these properties in.csproj or Directory.Build.props:

EnablePreviewFeatures:

<EnablePreviewFeatures>true</EnablePreviewFeatures>

Report: ".NET preview features enabled. Access to preview APIs and types."

Runtime-async feature flag (.NET 11+):

<Features>$(Features);runtime-async=on</Features>

Report: "Runtime-async enabled. Async/await uses runtime-level execution instead of compiler state machines."

Note: runtime-async requires <EnablePreviewFeatures>true</EnablePreviewFeatures> as well.

5d. Multi-targeting Details

If multi-targeting was detected (Step 2), also note:

  • Which TFMs are LTS vs STS vs Preview
  • Which TFMs are approaching end-of-support
  • Suggest [skill:dotnet-multi-targeting] for polyfill guidance

Structured Output Format

After detection, present results in this structured format:

.NET Version Detection Results
==============================
TFM:              net10.0 (or net8.0;net10.0 for multi-targeting)
Highest TFM:      net10.0
C# Version:       14 (default for net10.0)
SDK Version:      10.0.100 (from global.json)
Preview Features: none
Runtime-Async:    not enabled
Warnings:         none

Guidance: This project targets .NET 10 LTS with C# 14. Use modern patterns
including field-backed properties, collection expressions, and primary
constructors. All guidance will target net10.0 capabilities.

For multi-targeting:

.NET Version Detection Results
==============================
TFMs:             net8.0;net10.0
Highest TFM:      net10.0
C# Version:       14 (default for highest TFM)
SDK Version:      10.0.100 (from global.json)
Preview Features: none
Warnings:         net8.0 reaches end of support Nov 2026

Guidance: Multi-targeting net8.0 and net10.0. Guide on net10.0 patterns.
For net8.0 compatibility, use PolySharp/Polyfill for language features.
See [skill:dotnet-multi-targeting] for detailed polyfill guidance.

Edge Cases

No.csproj Found

If no .csproj exists in the workspace:

  • Check for .sln or .slnx files and look for referenced projects
  • If no project files found, continue the fallback chain:

1. Read global.json for SDK version (Step 4a) and infer TFM from it 2. If no global.json, use dotnet --version (Step 4b) to infer TFM 3. Only if both inference methods fail: "No.NET project or SDK detected. Defaulting guidance to net10.0 (current LTS). Use dotnet new to create a project."

MSBuild Property Indirection

If <TargetFramework> contains $(PropertyName):

  • Emit: "Unresolved property: $(PropertyName). Cannot determine TFM from static analysis."
  • Fall back to global.json SDK version, then dotnet --version
  • Recommend verifying TFM via dotnet --list-sdks or dotnet msbuild -getProperty:TargetFramework

Inconsistent Files

If.csproj says net10.0 but global.json pins SDK 9.0.100:

  • Prefer the.csproj TFM (higher precedence)
  • Warn about the mismatch
  • Suggest updating global.json to match

No SDK Installed

If dotnet --version fails or is not found:

  • Report: "No.NET SDK detected on this system. Install from https://dot.net"
  • If project files exist, still report the TFM from project files
  • Note that builds will fail without the SDK

.fsproj and .vbproj

The same detection logic applies to F# (.fsproj) and VB.NET (.vbproj) projects. The <TargetFramework> element is identical across all.NET project types.


Caching Behavior

Version detection results should be cached per-project (per.csproj path). Re-detect when:

  • The user switches to a different project within the solution
  • The user explicitly asks to re-detect
  • A .csproj, Directory.Build.props, or global.json file is modified

Version-to-Feature Reference Data

Last updated: 2026-02-11

This reference data maps.NET versions to their C# language versions, key features, and support lifecycle. This section is separate from the detection logic above -- detection determines which version is in use; this data maps that version to available features.

Version Matrix

.NET VersionStatusC# VersionTFMSupport EndNotes
.NET 8LTS (active)C# 12net8.0Nov 2026Approaching end of support
.NET 9STSC# 13net9.0May 2026Approaching end of support
.NET 10LTS (current)C# 14net10.0Nov 2028Recommended for new projects
.NET 11Preview 1C# 15 (preview)net11.0TBD (expected STS end: ~May 2028 if Nov 2026 GA)Preview only -- not for production

C# Version Feature Highlights

C# 12 (net8.0)

  • Primary constructors for classes/structs
  • Collection expressions ([1, 2, 3])
  • ref readonly parameters
  • Default lambda parameters
  • Alias any type with using
  • Inline arrays
  • Interceptors (experimental)

C# 13 (net9.0)

  • params collections (any collection type)
  • Lock type (System.Threading.Lock)
  • New escape sequence \e
  • Method group natural type improvements
  • Implicit indexer access in object initializers
  • ref and unsafe in iterators/async
  • Partial properties

C# 14 (net10.0)

  • Field-backed properties (field contextual keyword)
  • nameof for unbound generic types
  • Extension improvements (extension blocks)
  • First-class Span<T> in more contexts
  • allows ref struct anti-constraint for generics

C# 15 preview (net11.0)

  • Collection expression arguments (with() syntax for capacity/comparers): List<int> nums = [with(capacity: 32), 0,..evens,..odds]; HashSet<string> names = [with(comparer: StringComparer.OrdinalIgnoreCase), "Alice"];
  • Additional features expected as.NET 11 progresses through preview

.NET 11 Preview 1 Notable Features

These features are available when net11.0 TFM is detected with preview features enabled:

  • Runtime-async: Async/await at runtime level (requires <EnablePreviewFeatures>true</EnablePreviewFeatures> + <Features>$(Features);runtime-async=on</Features>)
  • Zstandard compression: System.IO.Compression.Zstandard (2-7x faster than Brotli/Deflate)
  • BFloat16: System.Numerics.BFloat16 for AI/ML workloads
  • Happy Eyeballs: ConnectAlgorithm.Parallel for dual-stack networking
  • CoreCLR for Android: Default runtime for MAUI Android Release builds
  • XAML source generation: Default in MAUI (replaces XAMLC)
  • EF Core: Complex types + JSON columns with TPT/TPC inheritance
  • CoreCLR on WASM: Experimental alternative to Mono for Blazor WASM

Support Lifecycle Guidance

When reporting version information, include lifecycle context:

  • End-of-support approaching (within 6 months): Warn and suggest [skill:dotnet-version-upgrade]
  • Preview/RC: Warn "not for production use" unless user explicitly opted in
  • STS reaching end: Note shorter support window compared to LTS
  • Current LTS: Confirm as recommended target for new projects

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.12%
按下载量换算43

Claude

31.12%
按下载量换算36

Cursor

20.06%
按下载量换算23

Gemini CLI

9.53%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills