Tangent.Analyzers
0.1.0-preview.1
dotnet add package Tangent.Analyzers --version 0.1.0-preview.1
NuGet\Install-Package Tangent.Analyzers -Version 0.1.0-preview.1
<PackageReference Include="Tangent.Analyzers" Version="0.1.0-preview.1"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Tangent.Analyzers" Version="0.1.0-preview.1" />
<PackageReference Include="Tangent.Analyzers"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Tangent.Analyzers --version 0.1.0-preview.1
#r "nuget: Tangent.Analyzers, 0.1.0-preview.1"
#:package Tangent.Analyzers@0.1.0-preview.1
#addin nuget:?package=Tangent.Analyzers&version=0.1.0-preview.1&prerelease
#tool nuget:?package=Tangent.Analyzers&version=0.1.0-preview.1&prerelease
Tangent.Analyzers
The Roslyn analyzer for Tangent, an architectural conformance checker for .NET.
You describe the architecture of a solution in .tan files in a .tangent/ folder at the solution root: the layers, which way dependencies may flow, and the rules for controllers, handlers, repositories and entities. This package reports every place the code breaks those rules, in the IDE and in dotnet build.
Install
dotnet add package Tangent.Analyzers --prerelease
Tangent is in preview, so the command needs --prerelease.
The package is a development dependency, so it never flows to the projects that reference yours. To check every project, add the reference once in Directory.Build.props at the solution root:
<ItemGroup>
<PackageReference Include="Tangent.Analyzers" Version="x.y.z" PrivateAssets="all" />
</ItemGroup>
The package finds the nearest folder above each project that contains .tangent/, and gives every .tan file in it to the compiler. Set the TangentRoot property to use another folder.
A contract
project "Orders" {
layer Api = Orders.Api.**
layer Application = Orders.Application.**
layer Domain = Orders.Domain.**
layer Infrastructure = Orders.Infrastructure.**
Api -> Application, Domain
Application -> Domain
Infrastructure -> Application, Domain
Domain -> nothing
}
contract Controller {
match: class in Api where name ends with "Controller"
sealed
attributes [ApiController], [Route(*)]
ctor { injects only IMediator, ILogger<*> }
forbid using Orders.Infrastructure.**
}
What you get
- Diagnostics with ids
TNG0001toTNG9000. Each message names the broken rule and the.tanline that declares it. - Code fixes for the mechanical rules, such as a missing
sealedor a missing attribute. - A
Tangent.Contractsclass with one constant per contract, so[Tangent(Contracts.Controller)]binds a type to a contract without a string that can be misspelt.
Violations are warnings by default. To fail the build on any of them, add this to .editorconfig:
[*.cs]
dotnet_analyzer_diagnostic.category-Tangent.severity = error
Related packages
Tangent.Cli: thetangentcommand for CI, SARIF reports, fixes and the architecture graph.Tangent.Attributes:[Tangent]and[TangentIgnore].
The language reference and the diagnostic catalogue are on GitHub.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
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 |
|---|---|---|
| 0.1.0-preview.1 | 66 | 10/13/2026 |