Layer dependency direction (ARCH1201)
هذا المحتوى غير متوفر بلغتك بعد.
Key dotnet.architecture.layer-dependency · Severity error · Category architecture · Approach clean-architecture
A project in an inner layer (Domain, Application) must not reference a project in an outer layer (Infrastructure, Presentation). Dependencies point inward, toward the stable core; the outer layers depend on abstractions the inner layers own. The rule reads the ProjectReference graph of the solution, so it needs no build - the csproj graph is the module graph. It only applies to projects whose layer can be inferred from the project name or root namespace, and only when the project selected the Clean Architecture approach.
Incorrect
Section titled “Incorrect”<!-- MyShop.Domain.csproj --><ItemGroup> <ProjectReference Include="..\MyShop.Infrastructure\MyShop.Infrastructure.csproj" /></ItemGroup>Correct
Section titled “Correct”<!-- MyShop.Infrastructure.csproj --><ItemGroup> <ProjectReference Include="..\MyShop.Domain\MyShop.Domain.csproj" /></ItemGroup>