Directory.Build.props
View on GitHub · Raw
<!-- dotnet-awesome-humans template | targets: net10.0, csharp-14, fsharp-10 | last-reviewed: 2026-08-20 | last-used: 2026-09-24 | sources: ms-learn, dotnet-blog, house -->
<!-- Copy to the repository root. Every project inherits these; override per-project only with a recorded reason. -->
<Project>
<PropertyGroup Label="Output layout">
<!-- One artifacts/<type>/<project>/<pivot> root for all build output. Must be set here or on the
command line — MSBuild reads it before project evaluation, so a .csproj setting fails with
NETSDK1199 (opinions/project-structure.md). -->
<UseArtifactsOutput>true</UseArtifactsOutput>
</PropertyGroup>
<PropertyGroup Label="Targets and language">
<TargetFramework>net10.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<!-- Promotes nullable warnings to errors so annotations are enforced, not advisory (opinions/csharp.md) -->
<WarningsAsErrors>nullable</WarningsAsErrors>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup Label="Quality gates">
<!-- **House:** always on, not just in CI: a warning is an error the moment it's introduced. Suppress with NoWarn/pragma only alongside a comment explaining why. -->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisLevel>latest-recommended</AnalysisLevel>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<PropertyGroup Label="Packaging hygiene">
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<!-- CPM above pins the dependency graph; flip this to true and add locked-mode restore in CI
if you also want packages.lock.json guarding against feed drift (opinions/ci.md). -->
<RestorePackagesWithLockFile>false</RestorePackagesWithLockFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- Doc file feeds IDE tooltips and OpenAPI XML comments; CS1591 exempted so undocumented internals don't fail the build -->
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
<ItemGroup Label="Analyzers">
<!-- Correctness rules the SDK set misses (culture-sensitive strings, CancellationToken
forwarding, async pitfalls); see opinions/csharp.md. Version pinned in
Directory.Packages.props. -->
<PackageReference Include="Meziantou.Analyzer" PrivateAssets="all" />
</ItemGroup>
<PropertyGroup Label="Deterministic builds">
<Deterministic>true</Deterministic>
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>
</Project>