Siemens.AspNet.CodeRules 7.8.18

Prefix Reserved
This package has a SemVer 2.0.0 package version: 7.8.18+15.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Siemens.AspNet.CodeRules --version 7.8.18
                    
NuGet\Install-Package Siemens.AspNet.CodeRules -Version 7.8.18
                    
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="Siemens.AspNet.CodeRules" Version="7.8.18" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Siemens.AspNet.CodeRules" Version="7.8.18" />
                    
Directory.Packages.props
<PackageReference Include="Siemens.AspNet.CodeRules" />
                    
Project file
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 Siemens.AspNet.CodeRules --version 7.8.18
                    
#r "nuget: Siemens.AspNet.CodeRules, 7.8.18"
                    
#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 Siemens.AspNet.CodeRules@7.8.18
                    
#: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=Siemens.AspNet.CodeRules&version=7.8.18
                    
Install as a Cake Addin
#tool nuget:?package=Siemens.AspNet.CodeRules&version=7.8.18
                    
Install as a Cake Tool

Siemens.AspNet.CodeRules

The code rules of the Siemens ASP.NET SDK as one rule pack.

Architecture and convention rules for repositories built with the Siemens ASP.NET SDK: Minimal API endpoints, request validation, DynamoDB, records, classes, services, projects, NuGet packaging and tests. The rules run on the code rule engine as tests or with the coderules CLI.


Installation

dotnet add package Siemens.AspNet.CodeRules

Together with a test adapter in your code rule project, e.g. Siemens.AspNet.CodeRules.MSTest.

Usage

public sealed class CodeRuleSetup : ICodeRuleSetup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddCodeRuleEngine("MyRepo.slnx", o => o.AddRulePack<SdkRules>()
                                                       .SkipRule<SomeRule>("accepted until #1234"));
    }
}

Every public rule of the pack becomes one generated test. Skip a rule, a group or a tag with a reason, accept single findings in the code with [SuppressMessage].

Rules

Every rule has a stable id (RJIT_CR_<CATEGORY>_<NUMBER>), a title, why it exists and how to fix a finding. The full list is in the rule set documentation.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
7.8.19 37 12/4/2026
7.8.18 39 12/4/2026
7.8.17 151 12/3/2026
7.8.16 36 12/3/2026
7.8.15 34 12/2/2026
7.8.14 38 12/2/2026
7.8.13 54 12/2/2026
7.8.11 43 12/2/2026
7.8.10 166 12/1/2026
7.8.9 54 12/1/2026

## Next

First release as a NuGet package: the code rules of the Siemens ASP.NET SDK as one rule pack.

- `AddRulePack<SdkRules>()` registers every rule: Minimal API, validation, DynamoDB, records, classes, interfaces, services, projects, NuGet packaging and test conventions.
- Skip single rules, groups or tags with the engine options, always with a reason.

### Validation test engine (`Siemens.AspNet.MsTest.Sdk`)

- **Breaking:** `RJIT_CR_MAPI_00026` accepts only a `[DynamicRequestValidation<T>]` test as coverage of a validated request. Hand-written `Status_422_UnprocessableContent/Requests/*.json` cases no longer count. Custom validation attributes count as validated now, and the suggested test takes the case as one string and passes it to `ValidationTestRunner.AssertAsync`. The class name is unchanged, so existing `SkipRule<...>` keep working.
- `RJIT_CR_T_00041`: every custom validation attribute has its rule test case `XyzRuleTestCase : ValidationRuleTestCaseBase<XyzAttribute>` (only in solutions with a `[DynamicRequestValidation]` test).
- `RJIT_CR_T_00042`: a rule test case is named after the rule it describes - `{Rule}RuleTestCase`.
- `RJIT_CR_T_00043`: a `[DynamicRequestValidation]` test takes the validation case as one string and passes it on unchanged.
- `RJIT_CR_T_00044`: the `HttpAction` and the route of `[DynamicRequestValidation<T>]` reach an endpoint that takes `T` (placeholder names, prefix and query do not matter). The finding shows the attribute with the verb and route of the endpoint.
- `RJIT_CR_T_00046`: every `[DynamicRequestValidation<T>]` test has its committed `Baselines/<T>.Schema.json`, and every schema snapshot has its test - a missing snapshot is found at build time instead of as a red CI run.
- `RJIT_CR_T_00047`: every placeholder of the route (query included) gets a value through `routeParameters`.
- `RJIT_CR_T_00048`: a `[DynamicRequestValidation]` test lives below `Status_422_UnprocessableContent`.
- `RJIT_CR_T_00049`: a validation rule is described by exactly one rule test case - a second one would make the engine refuse its catalog at discovery.
- `RJIT_CR_T_00050`: a rule test case for an sdk validation attribute carries `[ReplacesSdkRule("why")]`.
- `RJIT_CR_T_00045` (**breaking**): the folder of a `[DynamicRequestValidation]` test holds no `Requests/` / `Responses/` json and no `[DynamicRequestLocator]` tests - only the recorded `Baselines/` (schema snapshot `<RequestType>.Schema.json`). A snapshot still in `Responses/<RequestType>.json` is reported with the hint to move it. Simple cases belong into a validation attribute; only a complex 422 the engine cannot express (deployed resource, stored data) keeps a hand-written test. Both kinds side by side: the engine test goes into `Status_422_UnprocessableContent/Dynamic/`, the hand-written ones into folders named after what they check (`Deployed/`, `Complex/`, ...).
- `RJIT_CR_T_00021` accepts a `Status_422_UnprocessableContent` class whose test is a `[DynamicRequestValidation]` test.