.NET solution and project structure conventions. Covers .slnx format, Directory.Build.props, Directory.Packages.props for central package management, global usings, and naming conventions. Load this skill when setting up a new solution, adding projects, configuring build properties, or when the user mentions "solution structure", ".slnx", "Directory.Build.props", "central package management", "Directory.Packages.props", "global usings", ".editorconfig", "project layout", or "naming conventions".
Central package management — Use Directory.Packages.props to manage NuGet package versions in one place. No version numbers in individual .csproj files.
Shared build properties — Use Directory.Build.props for common settings (target framework, nullable, implicit usings). Don't repeat in every project.
.slnx for solutions — The new XML-based solution format is cleaner and more merge-friendly than the legacy .sln format.
src/tests separation — Source projects in src/, test projects in tests/. Clear boundary.
<!-- BAD — version in every .csproj, version drift --><PackageReference Include="Mediator.Abstractions" Version="2.0.0" /> <!-- in Project A --><PackageReference Include="Mediator.Abstractions" Version="3.0.0" /> <!-- in Project B --><!-- GOOD — central management, one version --><!-- Directory.Packages.props: <PackageVersion Include="Mediator.Abstractions" Version="3.0.0" /> --><!-- .csproj: <PackageReference Include="Mediator.Abstractions" /> -->
Don't Repeat Build Properties
xml
<!-- BAD — same properties in every .csproj --><PropertyGroup> <TargetFramework>net10.0</TargetFramework> <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings></PropertyGroup><!-- GOOD — once in Directory.Build.props, inherited everywhere -->
Don't Mix Source and Test Projects
# BAD — tests mixed with sourcesrc/ MyApp.Api/ MyApp.Api.Tests/ # test project in src/# GOOD — clear separationsrc/ MyApp.Api/tests/ MyApp.Api.Tests/
<!-- BAD — version in every .csproj, version drift --><PackageReference Include="Mediator.Abstractions" Version="2.0.0" /> <!-- in Project A --><PackageReference Include="Mediator.Abstractions" Version="3.0.0" /> <!-- in Project B --><!-- GOOD — central management, one version --><!-- Directory.Packages.props: <PackageVersion Include="Mediator.Abstractions" Version="3.0.0" /> --><!-- .csproj: <PackageReference Include="Mediator.Abstractions" /> -->
<!-- BAD — same properties in every .csproj --><PropertyGroup> <TargetFramework>net10.0</TargetFramework> <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings></PropertyGroup><!-- GOOD — once in Directory.Build.props, inherited everywhere -->
# BAD — tests mixed with sourcesrc/ MyApp.Api/ MyApp.Api.Tests/ # test project in src/# GOOD — clear separationsrc/ MyApp.Api/tests/ MyApp.Api.Tests/