Skip to content

Getting Started

This guide shows the shortest path from a .NET repository to an executable architecture policy.

1. Install or run the tool

During ArchLinterNet development, run the CLI from source:

dotnet run --project src/ArchLinterNet.Cli -- --policy architecture/dependencies.arch.yml --mode strict

After the .NET tool is installed from NuGet.org, run:

arch-linter-net --policy architecture/dependencies.arch.yml --mode strict

See Installation for global tool, local tool, and package usage.

2. Create a policy

Create architecture/dependencies.arch.yml at the repository root. Start with a small rule that maps to real namespaces and passes or fails for a known reason.

version: 1
name: My Architecture Contract

layers:
  application:
    namespace: MyApp.Application
  domain:
    namespace: MyApp.Domain
  infrastructure:
    namespace: MyApp.Infrastructure

analysis:
  target_assemblies:
    - MyApp.Application
    - MyApp.Domain
    - MyApp.Infrastructure

contracts:
  strict:
    - id: application-not-infrastructure
      name: application-must-not-depend-on-infrastructure
      source: application
      forbidden: [infrastructure]
      reason: Application code must depend on abstractions, not concrete infrastructure.

  strict_layers:
    - id: clean-architecture-layering
      name: clean-architecture-layering
      layers:
        - infrastructure
        - application
        - domain
      reason: Dependencies must point inward toward the domain.

See First policy for a walkthrough.

3. Choose strict or audit

Use strict contracts for boundaries that should block CI today.

Use audit contracts for migration discovery, future-state architecture, and known debt that should be visible before it becomes a gate.

arch-linter-net --mode strict
arch-linter-net --mode audit

4. Add CI

A common CI setup runs strict validation as a blocking step and audit validation as a non-blocking artifact:

- name: Validate architecture (strict)
  run: arch-linter-net --mode strict

- name: Architecture audit report
  if: always()
  continue-on-error: true
  run: arch-linter-net --mode audit --json > architecture-audit.json

See CI integration for full workflows.

5. Handle existing debt

When adopting ArchLinterNet in an existing repository, generate a baseline for current violations instead of weakening the rule:

arch-linter-net baseline generate \
  --config architecture/dependencies.arch.yml \
  --output architecture/baseline.arch.yml \
  --reason "Initial migration baseline"

Then validate with:

arch-linter-net --policy architecture/dependencies.arch.yml --baseline architecture/baseline.arch.yml --mode strict

See Migration baselines for the lifecycle.

Next steps