Ariadne.NET.Workspaces
0.2.2
See the version list below for details.
dotnet add package Ariadne.NET.Workspaces --version 0.2.2
NuGet\Install-Package Ariadne.NET.Workspaces -Version 0.2.2
<PackageReference Include="Ariadne.NET.Workspaces" Version="0.2.2" />
<PackageVersion Include="Ariadne.NET.Workspaces" Version="0.2.2" />
<PackageReference Include="Ariadne.NET.Workspaces" />
paket add Ariadne.NET.Workspaces --version 0.2.2
#r "nuget: Ariadne.NET.Workspaces, 0.2.2"
#:package Ariadne.NET.Workspaces@0.2.2
#addin nuget:?package=Ariadne.NET.Workspaces&version=0.2.2
#tool nuget:?package=Ariadne.NET.Workspaces&version=0.2.2
Ariadne.NET.Workspaces
Loads .NET solutions and projects with MSBuildWorkspace, so Ariadne.NET can check architecture rules against the compiler's semantic model. It brings in Ariadne.NET and Ariadne.NET.Abstractions.
Requirements
A .NET SDK on the machine. The package finds it with MSBuildLocator and loads MSBuild from it. With no SDK, the load fails with an
Unavailableerror.A
Microsoft.Build.Frameworkreference in every project that references this package. It keeps the MSBuild assemblies out of your output, and the exclusion does not flow from the package to you:<PackageReference Include="Microsoft.Build.Framework" Version="17.11.48" ExcludeAssets="runtime" />Without it the build fails with
MSBL001. TheBuildHost-netcoreandBuildHost-net472folders that the workspace needs come with the package and land in your output.A restored solution. Ariadne never restores. A project whose compilation is complete passes even if it was never restored, for example a project with no packages that targets the SDK's own framework. Any other project that does not compile fails the load, and when no
project.assets.jsonis found the error addsrun 'dotnet restore' first.
Use
using Ariadne.NET.Workspaces;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection()
.AddAriadneNETServices() // from Ariadne.NET
.AddAriadneNETWorkspaces() // ISolutionLoader and ISolutionValidator
.BuildServiceProvider();
var validator = services.GetRequiredService<ISolutionValidator>();
var result = await validator.ValidateAsync(resolvedPack, "MyApp.slnx");
ValidateAsync returns Result<ArchitectureReport, AriadneError>. It loads the path, checks the projects, lists the skipped ones in the report and disposes the workspace. ISolutionLoader.LoadAsync returns a LoadedSolution with the compilations, one per project and target framework, when you want to pass them to the engine's IArchitectureValidator yourself. Dispose it when you are done, because it owns the workspace.
Which projects are checked
The path may be a .sln, .slnx, .slnf or .csproj file, or a directory that holds exactly one of them. The projects the path names are checked, test projects included: every project of a .sln or .slnx, the listed projects of a .slnf, the one project of a .csproj. A project that one of them references is compiled as a reference only.
Projects that are not C#, such as .fsproj, .vbproj, .dcproj and .shproj, are skipped and listed in the report's SkippedProjects. A project that targets several frameworks is checked once per target framework.
When a load fails
A load is complete or it is an error. It fails on a workspace failure, on a compile error (the error lists the first 5), on a System.Object that does not resolve, and on a source file that a project lists and that is missing on disk. Warnings do not fail it.
See the documentation site for what counts as a dependency and for the rules the validator applies.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Ariadne.NET (>= 0.2.2)
- Microsoft.Build.Locator (>= 1.11.2)
- Microsoft.CodeAnalysis.CSharp.Workspaces (>= 5.9.0)
- Microsoft.CodeAnalysis.Workspaces.MSBuild (>= 5.9.0)
- Microsoft.VisualStudio.SolutionPersistence (>= 1.0.52)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Ariadne.NET.Workspaces:
| Package | Downloads |
|---|---|
|
Ariadne.NET.Testing
Checks a .NET solution against its Ariadne.NET architecture rule packs from a unit test, with one call that works in any test framework. |
GitHub repositories
This package is not used by any popular GitHub repositories.