Asgard.Analyzers
6.0.3
dotnet add package Asgard.Analyzers --version 6.0.3
NuGet\Install-Package Asgard.Analyzers -Version 6.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Asgard.Analyzers" Version="6.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Asgard.Analyzers" Version="6.0.3" />
<PackageReference Include="Asgard.Analyzers" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Asgard.Analyzers --version 6.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Asgard.Analyzers, 6.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Asgard.Analyzers@6.0.3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Asgard.Analyzers&version=6.0.3
#tool nuget:?package=Asgard.Analyzers&version=6.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Asgard.Analyzers
Asgard.Analyzers 是 Asgard 代码规范的 Roslyn 分析器包,用于在构建期统一执行仓库约定,帮助团队尽早发现风格偏差和结构性问题。
适用场景
- 希望在本地构建和 CI 中统一执行 Asgard 规则
- 需要把 Asgard 的编码约束分发到多个项目
- 想在 IDE 和编译阶段尽早发现不符合规范的代码
当前规则覆盖
- 禁止在源码文件中声明普通
using,要求统一改用GlobalUsings - 禁止使用包含
{T}一类占位符的文件名 - 要求注释内容使用中文表达
- 要求参数空值校验使用
ArgumentNullException.ThrowIfNull(...) - 要求单个
.cs文件只包含一个顶层类型 - 要求非测试代码文件的顶层声明注释覆盖率不低于 80%
安装
推荐仅在当前项目内生效:
<PackageReference Include="Asgard.Analyzers" Version="4.1.1" PrivateAssets="all" />
如果你希望规则继续透传到下游项目,可以按实际需要移除 PrivateAssets="all"。
打包输出
该包通过 analyzers/dotnet/cs 目录分发分析器程序集,可直接执行以下命令生成 NuGet 包:
dotnet pack .\Common\Asgard.Analyzers\Asgard.Analyzers.csproj -c Release
配套规范来源
分析器规则与 Asgard 的项目级约定保持同步,推荐配套阅读和使用以下资源:
- 主仓库:BenLampson/Asgard
- Asgard Skills 仓库:BenLampson/Asgard.Skills
Asgard.Skills 仓库包含 Asgard 的 AI 技能定义、编码规范和协作约束,适合与本分析器一起使用,形成“提示约束 + 编译校验”的闭环。
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.CodeAnalysis.CSharp (>= 5.9.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 6.0.3 | 83 | 10/11/2026 |
| 6.0.2 | 91 | 10/8/2026 |
| 6.0.1 | 76 | 10/8/2026 |
| 6.0.0 | 92 | 10/1/2026 |
| 5.3.0 | 147 | 10/1/2026 |
| 5.2.3 | 85 | 10/1/2026 |
| 5.2.2 | 114 | 9/1/2026 |
| 5.2.1 | 110 | 8/26/2026 |
| 5.2.0 | 163 | 8/6/2026 |
| 5.1.5 | 117 | 8/4/2026 |
| 5.1.4 | 121 | 8/3/2026 |
| 5.1.3 | 123 | 7/26/2026 |
| 5.1.2 | 153 | 7/20/2026 |
| 5.1.1 | 111 | 7/20/2026 |
| 5.1.0 | 116 | 7/20/2026 |
| 5.0.3 | 122 | 7/15/2026 |
| 5.0.2 | 114 | 7/15/2026 |
| 5.0.1 | 123 | 7/8/2026 |
| 4.1.11 | 125 | 6/30/2026 |
| 4.1.10 | 119 | 6/28/2026 |
Loading failed