Cycles, boundaries, naming, and placement rules
ArchUnit.NET
Architecture testing for .NET. Analyze C# projects and express boundaries as fluent, testable rules. The alpha includes cycles, dependency policies, naming, presets, baselines, and SARIF or HTML reporting for xUnit, NUnit, MSTest, and framework-neutral use.
NuGet
dotnet add package ArchUnit --version 2.4.0-alpha.2using ArchUnitNet;
using ArchUnitNet.Testing.XUnit;
[Fact]
public async Task DomainStaysIndependent()
{
var rule = ArchUnit.ProjectFiles("./App.csproj")
.InPath("src/Domain/**")
.ShouldNot()
.DependOnFiles()
.InPath("src/Infrastructure/**");
await rule.PassesAsync();
}The ecosystem
.NET, in context.
.NET is Microsoft's cross-platform application runtime and developer platform. C# is its most widely used language, although .NET also supports F# and Visual Basic. Teams use C# and .NET for ASP.NET web APIs, cloud services, desktop applications, games, and large enterprise systems.
C# is the primary language; .NET is the runtime and platform
ASP.NET, cloud services, desktop software, and games
xUnit, NUnit, and MSTest integration paths
Adoption snapshot
Public adoption, in context.
NuGet reports 82 downloads for the current ArchUnit alpha package. NuGet does not expose a directly comparable rolling 30-day total.
- Package status
- Published on NuGet Public download totals
- Reported history
- 82 All versions through Oct 4, 2026
- Latest 30 days
- Unavailable No comparable 30-day figure
- GitHub stars
- 2 Snapshot of October 4, 2026
Capabilities
What ArchUnit.NET brings to the test suite.
The family shares a recognizable architecture vocabulary while each implementation stays honest about its language, toolchain, and maturity.
xUnit, NUnit, and MSTest adapters
Architecture presets and gradual-adoption baselines
SARIF, JSON, text, and HTML reports
Structured violations for custom assertions
Async and framework-neutral execution
Go deeper
Adopt boundaries without stopping delivery.
Baselines let an established solution record existing violations and fail only when new ones appear. Teams can then remove old debt deliberately while protecting every improvement.
var rule = ArchUnit.ProjectFiles("./Commerce.sln")
.InPath("src/**")
.Should()
.HaveNoCycles();
var result = await rule.CheckAsync();
Assert.True(result.Passed, result.Format());Documentation highlights
Work with ArchUnit.NET beyond the quickstart.
ArchUnit.NET uses Roslyn to read C# projects and keeps extraction, projection, assertion, and reporting separate. The current alpha is designed for realistic adoption through familiar .NET test runners and structured output.
Read the solution through Roslyn
C# syntax trees and project information become normalized dependency edges before any rule is evaluated.
- Project and solution entry points support file, naming, cycle, and dependency-direction checks.
- The same extracted graph is projected into files, layers, slices, and metrics rather than reparsed for every rule family.
- Package installation uses ArchUnit, while the C# namespaces remain under ArchUnitNet.
Adopt rules without hiding legacy debt
Violation baselines allow an established solution to record existing findings while failing on newly introduced architectural drift.
- Architecture presets provide a faster starting point for recurring solution shapes.
- xUnit, NUnit, and MSTest adapters sit above the same generic CheckAsync result.
- Structured violations make it possible to write organization-specific assertions without parsing console text.
Bring findings into delivery
Text and HTML reports serve people, JSON serves automation, and SARIF can place architecture findings beside other code-scanning results.
- dotnet test remains the ordinary execution path in local development and CI.
- Performance profiling helps teams understand extraction cost on larger solutions.
- The alpha status is explicit: APIs may change while extraction and the full test matrix are hardened.
Release and compatibility
2.4.0-alpha.2
An evaluation-only alpha under active development. APIs and behavior can still change before a stable release.
Where it fits
Put boundaries next to the code they protect.
Common starting points for ArchUnit.NET include the following project shapes.
More ecosystems
The same intent, expressed natively.
Explore sibling implementations and carry the architecture vocabulary across a polyglot system.
Make the first boundary executable.
Add one meaningful rule, run it with the existing tests, and grow the architecture suite as the system reveals where it needs protection.
Start with ArchUnit.NET ↗