cCoder.CodeAnalysis.Contracts
2026.9.30.859
See the version list below for details.
dotnet add package cCoder.CodeAnalysis.Contracts --version 2026.9.30.859
NuGet\Install-Package cCoder.CodeAnalysis.Contracts -Version 2026.9.30.859
<PackageReference Include="cCoder.CodeAnalysis.Contracts" Version="2026.9.30.859" />
<PackageVersion Include="cCoder.CodeAnalysis.Contracts" Version="2026.9.30.859" />
<PackageReference Include="cCoder.CodeAnalysis.Contracts" />
paket add cCoder.CodeAnalysis.Contracts --version 2026.9.30.859
#r "nuget: cCoder.CodeAnalysis.Contracts, 2026.9.30.859"
#:package cCoder.CodeAnalysis.Contracts@2026.9.30.859
#addin nuget:?package=cCoder.CodeAnalysis.Contracts&version=2026.9.30.859
#tool nuget:?package=cCoder.CodeAnalysis.Contracts&version=2026.9.30.859
cCoder.CodeAnalysis
View the latest code coverage report
cCoder.CodeAnalysis analyses C# projects against the architectural and coding conventions defined by The Standard. It reports findings through normal compiler diagnostics and produces a portable architecture document for tooling and visualisation.
Installation
Add one package reference to each project that should be analysed:
<PackageReference Include="cCoder.CodeAnalysis" Version="2026.7.22.0000" />
No separate analyzer or build-task package is required. Building the project activates the compiler analyzer and, for non-test projects, generates project.stxjson beside the project file.
The package currently requires the .NET 10 SDK for its build integration.
Runtime libraries that implement IUtilityBroker or ICompositionExposure must also reference the lightweight contracts package directly:
<PackageReference Include="cCoder.CodeAnalysis" Version="2026.7.22.0000" PrivateAssets="all" />
<PackageReference Include="cCoder.CodeAnalysis.Contracts" Version="2026.7.22.0000" />
The contracts package contains only the runtime marker interfaces. Keeping it separate prevents applications from loading the Roslyn-based analyzer assembly to resolve a marker implemented by a runtime library.
Build behaviour
During a normal build the package:
- Analyses the Roslyn compilation.
- Emits each analysis item as an
STXcompiler diagnostic, making it visible in build output and the Visual Studio Error List. - Generates
project.stxjsonafter a successful non-test build. - Avoids rewriting an unchanged architecture document.
Projects with IsTestProject set to true are still analysed, but do not produce an architecture document.
Generation can be disabled or redirected when required:
<PropertyGroup>
<cCoderCodeAnalysisGenerateArchitecture>false</cCoderCodeAnalysisGenerateArchitecture>
<cCoderCodeAnalysisArchitecturePath>$(MSBuildProjectDirectory)\architecture\project.stxjson</cCoderCodeAnalysisArchitecturePath>
</PropertyGroup>
Architecture document
The generated document contains:
- Classes and their Standard element types.
- Properties, methods, inputs, and fully qualified type names.
- Directed links between internal types.
- Analysis items including rule code, description, type, and source line.
Enum values are serialized as readable strings. Source paths are relative to the project containing project.stxjson, allowing the document to be moved with the project and consumed directly by Visual Studio or browser-based diagramming tools.
Standard element types
The model recognises the principal layers used by The Standard, including:
- Brokers and dependencies
- Foundation services
- Processing services
- Orchestration services
- Coordination services
- Management services
- Aggregation services
- Exposures and controllers
- Models
- Tests
Rules cover architectural dependencies, public contracts, exception handling, validation, naming, asynchronous operations, controller behaviour, test structure, source layout, and formatting.
Cardinality-aware method names
STX0028 requires a method that names its returned cCoder model or contract to use the singular subject for one result and the plural subject for a sequence. The rule resolves return types semantically, unwraps Task<T>, ValueTask<T>, and ActionResult<T>, and recognises arrays and standard collection/query contracts. Framework and third-party subjects, string, byte[], and methods that do not name their returned subject are outside its scope.
Plural names use a deterministic English inflection policy, including common irregular forms such as Person/People and unchanged terms such as Metadata.
Models are data carriers only. STXM001 rejects every explicitly declared method-like member, including instance and static constructors, destructors, operators, conversions, and overrides.
Runtime use
The architecture builder can also be resolved through dependency injection when analysis is needed programmatically:
ServiceCollection services = new ServiceCollection();
services.AddCodeAnalysis();
using ServiceProvider serviceProvider = services.BuildServiceProvider();
IArchitectureBuilder architectureBuilder = serviceProvider
.GetRequiredService<IArchitectureBuilder>();
Architecture architecture = architectureBuilder.Generate(
path: projectPath);
Building the repository
dotnet restore src/cCoder.CodeAnalysis.slnx
dotnet build src/cCoder.CodeAnalysis.slnx -c Release --no-restore
dotnet test src/cCoder.CodeAnalysis.Tests/cCoder.CodeAnalysis.Tests.csproj -c Release --no-build
dotnet test src/cCoder.CodeAnalysis.Sample.Tests/cCoder.CodeAnalysis.Sample.Tests.csproj -c Release --no-build
dotnet pack src/cCoder.CodeAnalysis.Contracts/cCoder.CodeAnalysis.Contracts.csproj -c Release --no-restore
dotnet pack src/cCoder.CodeAnalysis/cCoder.CodeAnalysis.csproj -c Release --no-restore
The sample projects provide known valid and deliberately invalid code used to verify every analysis rule. Deliberate rule violations are expected to appear as compiler warnings during repository builds.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (15)
Showing the top 5 NuGet packages that depend on cCoder.CodeAnalysis.Contracts:
| Package | Downloads |
|---|---|
|
cCoder.CodeAnalysis
Compiler-integrated standards analysis and portable architecture modelling for .NET projects. |
|
|
cCoder.Core
cCoder.Core |
|
|
cCoder.Eventing
cCoder.Eventing |
|
|
cCoder.ContentManagement
cCoder.ContentManagement |
|
|
cCoder.AppSecurity
cCoder.AppSecurity |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.9.30.1759 | 168 | 9/30/2026 |
| 2026.9.30.1047 | 351 | 9/30/2026 |
| 2026.9.30.1006 | 151 | 9/30/2026 |
| 2026.9.30.939 | 132 | 9/30/2026 |
| 2026.9.30.859 | 193 | 9/30/2026 |
| 2026.9.29.1241 | 264 | 9/29/2026 |
| 2026.9.29.1205 | 109 | 9/29/2026 |
| 2026.9.27.1258 | 333 | 9/27/2026 |
| 2026.9.27.1158 | 216 | 9/27/2026 |
| 2026.9.23.1632 | 489 | 9/23/2026 |