Skip to content

Commit 6eb5cda

Browse files
committed
Build settings: analyzers on, deterministic builds, warnings-as-errors locally only
1 parent ebe6812 commit 6eb5cda

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

Directory.Build.props

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
11
<Project>
2+
<!-- Global build settings for all projects in this repository -->
23
<PropertyGroup>
4+
<!-- Modern C# and safer null handling -->
35
<LangVersion>latest</LangVersion>
46
<Nullable>enable</Nullable>
5-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
7+
8+
<!-- Deterministic builds help reproducibility (CI/artifacts) -->
9+
<Deterministic>true</Deterministic>
10+
11+
<!-- Roslyn analyzers on with a broad ruleset -->
612
<EnableNETAnalyzers>true</EnableNETAnalyzers>
713
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
8-
<Deterministic>true</Deterministic>
9-
<!-- CI-friendly builds -->
10-
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
14+
15+
<!-- Be strict locally, more tolerant in CI:
16+
- On developer machines: warnings fail the build.
17+
- In CI: let warnings be warnings (prevents unexpected red builds). -->
18+
<TreatWarningsAsErrors Condition="'$(CI)' == '' and '$(GITHUB_ACTIONS)' == ''">true</TreatWarningsAsErrors>
19+
20+
<!-- Nicer error messages in logs -->
21+
<GenerateFullPaths>true</GenerateFullPaths>
22+
</PropertyGroup>
23+
24+
<!-- Release-specific knobs (optional but common) -->
25+
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
26+
<Optimize>true</Optimize>
27+
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
1128
</PropertyGroup>
1229
</Project>

0 commit comments

Comments
 (0)