-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
107 lines (96 loc) · 5.17 KB
/
Copy pathDirectory.Build.props
File metadata and controls
107 lines (96 loc) · 5.17 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
<Project>
<!-- Shared build configuration for all projects -->
<PropertyGroup>
<!-- Centralized versioning -->
<Version>0.1.0</Version>
<PackageVersion>$(Version)</PackageVersion>
<AssemblyVersion>0.1.0.0</AssemblyVersion>
<FileVersion>0.1.0.0</FileVersion>
</PropertyGroup>
<!--
Analyzer & Public API policy
############################
- We pin AnalysisLevel to a specific version to avoid CI drift when SDKs update.
- We enable .NET analyzers and enforce code style in build.
- Severities live in .editorconfig.
- Public API governance is enforced by Microsoft.CodeAnalysis.PublicApiAnalyzers.
* Keep exactly ONE pair of PublicAPI.Shipped.txt / PublicAPI.Unshipped.txt per project.
* If an API is TFM-specific, annotate the line with a trailing comment, e.g.:
// TFM: net8.0
// TFM: netstandard2.0
* To add or change public members: update the PublicAPI.Shipped.txt / PublicAPI.Unshipped.txt
files in the affected project and review the diff.
-->
<PropertyGroup>
<!-- Only provide default TFMs for packable projects when the project has not set TargetFramework/TargetFrameworks. -->
<TargetFrameworks Condition="'$(IsPackable)'=='true' and '$(TargetFramework)'=='' and '$(TargetFrameworks)'==''">net8.0;netstandard2.0</TargetFrameworks>
<!-- Language & build basics -->
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<!-- Analyzer policy (pinned for stability) -->
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<AnalysisLevel>8.0-recommended</AnalysisLevel>
<!-- Deterministic builds + docs -->
<Deterministic>true</Deterministic>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(IsPackable)'=='true'">
<Authors Condition="'$(Authors)'==''">KeelMatrix</Authors>
<RepositoryUrl Condition="'$(RepositoryUrl)'==''">https://github.com/KeelMatrix/QueryWatch</RepositoryUrl>
<RepositoryType Condition="'$(RepositoryType)'==''">git</RepositoryType>
<PackageLicenseExpression Condition="'$(PackageLicenseExpression)'==''">MIT</PackageLicenseExpression>
<PackageProjectUrl Condition="'$(PackageProjectUrl)'==''">https://github.com/KeelMatrix/QueryWatch#readme</PackageProjectUrl>
<PackageReadmeFile Condition="'$(PackageReadmeFile)'=='' and Exists('$(MSBuildProjectDirectory)\README.md')">README.md</PackageReadmeFile>
<PackageIcon Condition="'$(PackageIcon)'=='' and Exists('$(MSBuildThisFileDirectory)icon.png')">icon.png</PackageIcon>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<ItemGroup Condition="'$(IsPackable)'=='true'">
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="all" />
</ItemGroup>
<!-- Keep local telemetry and environment files out of every NuGet package. -->
<Target Name="ExcludeSensitiveFilesFromPack"
BeforeTargets="_GetPackageFiles"
Condition="'$(IsPackable)'=='true'">
<ItemGroup>
<None Remove="keelmatrix.telemetry.json" />
<None Remove=".env" />
<None Remove=".env.local" />
<Content Remove="keelmatrix.telemetry.json" />
<Content Remove=".env" />
<Content Remove=".env.local" />
</ItemGroup>
</Target>
<!-- Fail closed if an explicit or future broad pack glob reintroduces one. -->
<Target Name="RejectSensitiveFilesInPack"
AfterTargets="_GetPackageFiles"
Condition="'$(IsPackable)'=='true'">
<ItemGroup>
<_SensitivePackageFile Include="@(_PackageFiles)"
Condition="'%(_PackageFiles.Filename)%(_PackageFiles.Extension)'=='keelmatrix.telemetry.json' Or '%(_PackageFiles.Filename)%(_PackageFiles.Extension)'=='.env' Or '%(_PackageFiles.Filename)%(_PackageFiles.Extension)'=='.env.local'" />
</ItemGroup>
<Error Condition="'@(_SensitivePackageFile)'!=''"
Text="Refusing to pack sensitive file(s): @(_SensitivePackageFile, ', ')." />
</Target>
<!-- Include Public API baseline files if they exist next to a project. -->
<ItemGroup>
<AdditionalFiles Remove="$(MSBuildProjectDirectory)\PublicAPI.Shipped.txt;$(MSBuildProjectDirectory)\PublicAPI.Unshipped.txt" />
</ItemGroup>
<ItemGroup Condition="Exists('$(MSBuildProjectDirectory)\PublicAPI.Shipped.txt')">
<AdditionalFiles Include="$(MSBuildProjectDirectory)\PublicAPI.Shipped.txt" />
</ItemGroup>
<ItemGroup Condition="Exists('$(MSBuildProjectDirectory)\PublicAPI.Unshipped.txt')">
<AdditionalFiles Include="$(MSBuildProjectDirectory)\PublicAPI.Unshipped.txt" />
</ItemGroup>
<!-- Tests: keep warnings as warnings unless a test project opts in -->
<PropertyGroup Condition="'$(IsTestProject)'=='true'">
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
</Project>