-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
146 lines (124 loc) · 8.97 KB
/
Copy pathDirectory.Build.props
File metadata and controls
146 lines (124 loc) · 8.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<Project>
<!--
Properties shared by EVERY project in the repository - the shipping libraries, the source generator,
the samples and the test projects. (tests/package-consumption/ is outside this on purpose: it carries
its own empty Directory.Build.props, which stops MSBuild's upward search before it reaches this file,
so those projects receive the library only from the packed packages.)
Anything that only a shipping library needs belongs in src/Directory.Build.props, and anything only the
test projects need belongs in tests/Directory.Build.props. MSBuild uses the NEAREST
Directory.Build.props and stops there, so both of those import this file explicitly.
-->
<PropertyGroup>
<!-- Single source of truth for the version every produced package carries. The packages are
released together, so this is one edit per release rather than one per project, and the CI
publish job verifies that the pushed v* tag matches this value before anything reaches
NuGet.org. The samples and tests inherit it too; they are never packed, so the only effect
there is that their assembly version tracks the repository's. -->
<Version>1.1.0</Version>
</PropertyGroup>
<PropertyGroup>
<Authors>David Liebeherr, rent-a-developer</Authors>
<Copyright>© David Liebeherr, rent-a-developer</Copyright>
</PropertyGroup>
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<NeutralLanguage>en</NeutralLanguage>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<!-- Packing is opt-in, not opt-out. Every project starts unpackable and the shipping projects
under src/ each set IsPackable=true themselves, so "which projects ship as packages" is
answered by those .csproj files rather than by whichever project last remembered to say no.
A new sample, test or tool project is silently unpackable, which is the safe default.
The files those packages carry are added by Directory.Build.targets. -->
<IsPackable>false</IsPackable>
</PropertyGroup>
<!-- Framework families used by the shipped libraries, the samples and tests, and the minimum-version
package consumers. Keeping the roles distinct prevents a routine SDK update from silently
raising the packages' compatibility floor. -->
<PropertyGroup>
<CurrentTargetFramework>net10.0</CurrentTargetFramework>
<CurrentWindowsTargetFramework>net10.0-windows</CurrentWindowsTargetFramework>
<LibraryTargetFrameworks>net8.0;net10.0</LibraryTargetFrameworks>
<WindowsLibraryTargetFrameworks>net8.0-windows;net10.0-windows</WindowsLibraryTargetFrameworks>
</PropertyGroup>
<!-- Naming conventions: every assembly is named after its project file; every namespace lives under
the RentADeveloper vendor prefix (ResXLocalization.Core overrides RootNamespace because its
types sit directly in RentADeveloper.ResXLocalization).
WPF's markup compiler builds a temporary copy of the project under a randomized
<Name>_<random>_wpftmp name; _TargetAssemblyProjectName then carries the real project name,
so prefer it to keep AssemblyName/RootNamespace stable during that pass. _ConventionProjectName
is also what the conditions in src/Directory.Build.props test, for the same reason. -->
<PropertyGroup>
<_ConventionProjectName>$(MSBuildProjectName)</_ConventionProjectName>
<_ConventionProjectName Condition="'$(_TargetAssemblyProjectName)' != ''">$(_TargetAssemblyProjectName)</_ConventionProjectName>
<AssemblyName>$(_ConventionProjectName)</AssemblyName>
<RootNamespace>RentADeveloper.$(_ConventionProjectName)</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<!-- CSharpier as a build step, so formatting is a build error like style and member ordering,
rather than something only the editor hooks, the pre-commit gate and CI notice.
Check, not format. Left at its default the package REWRITES source files during the build,
which turns building into editing: the file on disk stops being the file you asked the
compiler to compile. With Check the build fails instead and names the file, and fixing it
stays a deliberate act - scripts/tidy-code.ps1, or the editor hook that runs on every agent
edit.
CSharpier_Bypass=true skips it, for the rare case of needing a build out of a tree mid-edit. -->
<CSharpier_Check>true</CSharpier_Check>
</PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<!-- Every project generates an XML documentation file, including the samples and the tests, which
have no use for one. This is not about documentation: IDE0005 (unnecessary using directive) is
simply not REPORTED at build time unless the compilation produces a doc file, and it says so -
"Set MSBuild property 'GenerateDocumentationFile' to 'true' ... to enable IDE0005 on build",
https://github.com/dotnet/roslyn/issues/41640. Without this, an unused using is invisible to
the build in every project, and the price is an unread XML file in each project's obj/.
The samples and the tests do not document their public members, so CS1591 and CS1574 are in
their NoWarn lists, with the reason stated there. Under src/ both stay errors, which is what
keeps the public API documented. -->
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup>
<!-- NuGet's dependency audit, at its widest scope: NuGetAuditMode=all reports advisories against
transitive packages too, which is where they usually are - the direct references here are few
and watched, and a vulnerable package two levels down is exactly what would otherwise be
missed. The level is moderate rather than low, so the audit reports what is worth acting on.
WarningsNotAsErrors is what keeps this from being hostile. TreatWarningsAsErrors is on for
every project, so without it the publication of a new advisory anywhere in the transitive
graph would break an unrelated build, on a schedule nobody in this repository controls.
NU1901-NU1904 therefore stay warnings: visible in every build and in CI, and never a reason a
change that touched nothing cannot compile. Dependabot's security updates are what close
them. -->
<NuGetAudit>true</NuGetAudit>
<NuGetAuditMode>all</NuGetAuditMode>
<NuGetAuditLevel>moderate</NuGetAuditLevel>
<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(NoBuild)' == 'true'">
<!-- `dotnet pack` with the no-build switch sets NoBuild=true as a global property. The packable
projects run ResolveReferences while packing (see _AddAnalyzersToPackage), which would
otherwise invoke the Build target on their ProjectReferences and fail with NETSDK1085.
Everything is already built, so just stop project references from building again. -->
<BuildProjectReferences>false</BuildProjectReferences>
</PropertyGroup>
<ItemGroup>
<!-- One stylecop.json for the whole repository; $(MSBuildThisFileDirectory) is the repository
root. -->
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
</ItemGroup>
<!-- The analyzer set and the formatter every project builds with (build-time only, never a runtime
dependency). Versions live in Directory.Packages.props.
NewStyleCop is here for one job: reporting members that are in the wrong order. See the ordering
section of .editorconfig, which switches every StyleCop category off and turns only the ordering
rules plus SA1309 back on. -->
<ItemGroup>
<PackageReference Include="CSharpier.MsBuild" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="ErrorProne.NET.CoreAnalyzers" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="NewStyleCop.Analyzers" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="Roslynator.Analyzers" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="SonarAnalyzer.CSharp" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
</ItemGroup>
</Project>