Repository navigation
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
78 lines (73 loc) · 5.45 KB
/
Copy pathDirectory.Build.props
File metadata and controls
78 lines (73 loc) · 5.45 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
<Project>
<Import Project="eng/ReleaseVersion.props" />
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>14.0</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<AnalysisLevel>latest</AnalysisLevel>
<AnalysisMode>All</AnalysisMode>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<!-- NuGetAudit is on by default in the .NET 10 SDK (NuGetAuditMode=all for net10.0+ targets);
made explicit so the policy is visible in this file rather than an invisible SDK default.
TreatWarningsAsErrors above means a newly-disclosed advisory at NuGetAuditLevel or above fails
the build the day it is disclosed - deliberate, see docs/agent-knowledge/build-and-analyzers.md. -->
<NuGetAudit>true</NuGetAudit>
<NuGetAuditMode>all</NuGetAuditMode>
<NuGetAuditLevel>low</NuGetAuditLevel>
<!-- IDE0005 (unnecessary using) only runs when the compiler is asked to produce an XML doc file: without
this property Roslyn reports EnableGenerateDocumentationFile instead of the finding, whatever severity
.editorconfig gives IDE0005. Turning it on also makes the compiler PARSE every /// block, which is the
other half of the reason: the four XML-doc shape rules CommentBudgetConventionTests scans for are now
also enforced by csc. The doc file itself is not a deliverable, so PublishDocumentationFiles=false keeps
the .xml out of the published output the packaging reads - the plural form is load-bearing: the singular
PublishDocumentationFile excludes only the ENTRY project's file, and the 16 project references would each
still copy theirs into the publish folder, which is 16 files the package never carried before.
The suppressions below are POLICY: a <param> is written only when it adds information the name does not,
and an undocumented public member is the norm outside the seams that earn a doc, so CS1591/CS1573/CS1572
would fire on most of the tree by design (16-code-conventions.md). Every other XML-doc diagnostic is
enforced: an unresolved cref (CS1574), an ambiguous one (CS0419), a doc block on a non-documentable element
(CS1587) and a paramref naming no parameter (CS1734) fail the build like any other warning. -->
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PublishDocumentationFiles>false</PublishDocumentationFiles>
<!-- And out of bin/ as well, not only the publish folder: FastEndpoints and NJsonSchema read an .xml that sits next
to an assembly unconditionally, so the first build after GenerateDocumentationFile pushed 250 endpoint and DTO
/// blocks into the live OpenAPI document and openapi:check:live went red against the committed contract. The
compiler still writes the file under obj/, which is all IDE0005 and the /// shape rules need. -->
<CopyDocumentationFileToOutputDirectory>false</CopyDocumentationFileToOutputDirectory>
<NoWarn>$(NoWarn);CS1591;CS1573;CS1572</NoWarn>
</PropertyGroup>
<!-- Test/tooling projects are exempt from the extra banned-API + Meziantou guardrails: they
legitimately use ambient time, Thread.Sleep, and sync-over-async in fixtures/harnesses.
Product runtime code is held to the strict wall. (tools/AgentTemplateGenerator is already
isolated by its own Directory.Build.props, so it is not matched here.) -->
<PropertyGroup>
<IsTestOrToolingProject>false</IsTestOrToolingProject>
<IsTestOrToolingProject
Condition="$(MSBuildProjectName.EndsWith('.Tests')) Or $(MSBuildProjectName.Contains('.Tests.')) Or $(MSBuildProjectName.Contains('.Testing')) Or $(MSBuildProjectName.EndsWith('.AppHost'))">
true
</IsTestOrToolingProject>
</PropertyGroup>
<!-- Bridge so `dotnet test` (the VSTest entrypoint used in CI) actually runs the
Microsoft.Testing.Platform / TUnit suites instead of silently reporting "Zero tests ran".
Scoped to MTP test projects only. Without this the CI quality gate is hollow. -->
<PropertyGroup Condition="$(MSBuildProjectName.EndsWith('.Tests')) Or $(MSBuildProjectName.Contains('.Tests.'))">
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SonarAnalyzer.CSharp" PrivateAssets="all" Condition="$(MSBuildProjectExtension) == '.csproj'" />
</ItemGroup>
<!-- Extra static-analysis guardrails — production projects only.
NOTE: .Trim() is deliberate. XML reformatters (e.g. `jb cleanupcode`) pretty-print the
IsTestOrToolingProject element value onto its own line, and MSBuild preserves that surrounding
whitespace — so a bare '$(IsTestOrToolingProject)' != 'true' would be true even for test projects.
Trimming keeps the production-only scoping correct regardless of how the property is formatted. -->
<ItemGroup Condition="$(MSBuildProjectExtension) == '.csproj' And '$(IsTestOrToolingProject.Trim())' != 'true'">
<PackageReference Include="Meziantou.Analyzer" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" PrivateAssets="all" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)BannedSymbols.txt" Visible="false" />
</ItemGroup>
</Project>