Skip to content

Commit 2370da8

Browse files
this commit introduces common props files for all projects and build targets.
1 parent 6247fa1 commit 2370da8

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

Directory.Build.props

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project>
2+
<PropertyGroup>
3+
<Nullable>enable</Nullable>
4+
<ImplicitUsings>enable</ImplicitUsings>
5+
<LangVersion>latest</LangVersion>
6+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
7+
<!--
8+
Disabled CS8509 to allow switch expressions without a default case,
9+
assuming exhaustiveness is guaranteed by controlled types.
10+
11+
Disabled CS8524 for similar exhaustiveness reasons,
12+
assuming that all cases are handled in switch statements.
13+
14+
Disabled CS8618 because some non-nullable properties are initialized externally by
15+
frameworks, serializers, mappers, or dependency injection.
16+
-->
17+
<NoWarn>$(NoWarn);CS8509;CS8524;CS8618</NoWarn>
18+
</PropertyGroup>
19+
</Project>

Directory.Build.targets

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project>
2+
<Target Name="ValidateAppSettings" BeforeTargets="Build">
3+
<Error Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' AND !Exists('$(ProjectDir)appsettings.json')"
4+
Text="appsettings.json is required for web projects." />
5+
</Target>
6+
</Project>

0 commit comments

Comments
 (0)