.NET 6.0 .NET Standard 2.0
dotnet add package FsArchUnit --version
NuGet\Install-Package FsArchUnit -Version
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="FsArchUnit" Version="" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FsArchUnit --version
#r "nuget: FsArchUnit,"
#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.
// Install FsArchUnit as a Cake Addin
#addin nuget:?package=FsArchUnit&version=

// Install FsArchUnit as a Cake Tool
#tool nuget:?package=FsArchUnit&version=



A fsharp API for that can enforce architectural rules in unit tests.

A rewrite from BenMorris/NetArchTest which is inspired by the ArchUnit library for Java.


This project allows you create tests that enforce conventions for class design, naming and dependency in .Net code bases. These can be used with any unit test framework and incorporated into a build pipeline. It uses a fluid API that allows you to string together readable rules that can be used in test assertions.

There are plenty of static analysis tools that can evaluate application structure, but they are aimed more at enforcing generic best practice rather than application-specific conventions. The better tools in this space can be press-ganged into creating custom rules for a specific architecture, but the intention here is to incorporate rules into a test suite and create a self-testing architecture.

The project is inspired by ArchUnit, a java-based library that attempts to address the difficulties of preserving architectural design patterns in code bases over the long term. Many patterns can only be enforced by convention, which tends to rely on a rigorous and consistent process of code review. This discipline often breaks down as projects grow, use cases become more complex and developers come and go.


// Classes in the presentation should not directly reference repositories
let violations = Types.InCurrentDomain()
                 |> That (ResideInNamespace "SampleLibrary.Presentation")
                 |> Should (Not (HaveDependencyOn "SampleLibrary.Data"))
                 |> Check

// Classes in the "data" namespace should implement IRepository
let violations = Types.InCurrentDomain()
                 |> That ((HaveDependencyOn "System.Data") |> And <| (ResideInNamespace "ArchTest"))
                 |> Should (ResideInNamespace "SampleLibrary.Data")
                 |> Check

// All the service classes should be sealed
let violations = Types.InCurrentDomain()
                 |> That (ImplementInterface typedefof<IWidgetService>)
                 |> Should (Be Sealed)
                 |> Check
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.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. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

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 263 12/10/2022 307 10/23/2021