Asgard.Analyzers
6.0.0
dotnet add package Asgard.Analyzers --version 6.0.0
NuGet\Install-Package Asgard.Analyzers -Version 6.0.0
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.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Asgard.Analyzers" Version="6.0.0" />
<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.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Asgard.Analyzers, 6.0.0"
#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.0
#: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.0
#tool nuget:?package=Asgard.Analyzers&version=6.0.0
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.0 | 44 | 10/1/2026 |
| 5.3.0 | 72 | 10/1/2026 |
| 5.2.3 | 35 | 10/1/2026 |
| 5.2.2 | 99 | 9/1/2026 |
| 5.2.1 | 99 | 8/26/2026 |
| 5.2.0 | 157 | 8/6/2026 |
| 5.1.5 | 112 | 8/4/2026 |
| 5.1.4 | 116 | 8/3/2026 |
| 5.1.3 | 119 | 7/26/2026 |
| 5.1.2 | 149 | 7/20/2026 |
| 5.1.1 | 107 | 7/20/2026 |
| 5.1.0 | 111 | 7/20/2026 |
| 5.0.3 | 116 | 7/15/2026 |
| 5.0.2 | 108 | 7/15/2026 |
| 5.0.1 | 118 | 7/8/2026 |
| 4.1.11 | 120 | 6/30/2026 |
| 4.1.10 | 114 | 6/28/2026 |
| 4.1.9 | 119 | 6/7/2026 |
| 4.1.8 | 126 | 5/31/2026 |
| 4.1.7 | 118 | 5/24/2026 |
Loading failed