Tangent.Analyzers 0.1.0-preview.1

This is a prerelease version of Tangent.Analyzers.
dotnet add package Tangent.Analyzers --version 0.1.0-preview.1
                    
NuGet\Install-Package Tangent.Analyzers -Version 0.1.0-preview.1
                    
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="Tangent.Analyzers" Version="0.1.0-preview.1">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tangent.Analyzers" Version="0.1.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="Tangent.Analyzers">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 Tangent.Analyzers --version 0.1.0-preview.1
                    
#r "nuget: Tangent.Analyzers, 0.1.0-preview.1"
                    
#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 Tangent.Analyzers@0.1.0-preview.1
                    
#: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=Tangent.Analyzers&version=0.1.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Tangent.Analyzers&version=0.1.0-preview.1&prerelease
                    
Install as a Cake Tool

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 TNG0001 to TNG9000. Each message names the broken rule and the .tan line that declares it.
  • Code fixes for the mechanical rules, such as a missing sealed or a missing attribute.
  • A Tangent.Contracts class 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

The language reference and the diagnostic catalogue are on GitHub.

There are no supported framework assets in this package.

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