-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
275 lines (248 loc) · 13.6 KB
/
Directory.Build.props
File metadata and controls
275 lines (248 loc) · 13.6 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<Project>
<PropertyGroup>
<GITHUB_RUN_NUMBER Condition="'$(GITHUB_RUN_NUMBER)' == ''">0</GITHUB_RUN_NUMBER>
<!-- NuGet sources -->
<RestoreSources>https://api.nuget.org/v3/index.json;https://nuget.pkg.github.com/vmelamed/index.json</RestoreSources>
<!-- To use if there are OS-specific differences in the public .NET APIs -->
<DefineConstants Condition="'$(OS)' == 'WINDOWS_NT'">$(DefineConstants);WINDOWS</DefineConstants>
<DefineConstants Condition="'$(OS)' != 'WINDOWS_NT'">$(DefineConstants);UNIX</DefineConstants>
<!-- Use to define custom preprocessor symbols, e.g. "dotnet build -p:preprocessor_symbols="SHORT_RUN FEATURE_A FEATURE_B" ...",
without overriding the rest of the symbols like DEBUG, TRACE, etc. -->
<DefineConstants Condition="'$([System.String]::IsNullOrWhiteSpace($(preprocessor_symbols)))' != 'true'">$(DefineConstants);$(preprocessor_symbols)</DefineConstants>
<RepoRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'Directory.Build.props'))</RepoRoot>
</PropertyGroup>
<!-- ================ Common Settings for All projects ================ -->
<PropertyGroup Label="Packages">
<TargetFramework>net10.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<AnalysisLevel>latest</AnalysisLevel>
<WarningLevel>9999</WarningLevel>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<WarningsAsErrors>$(WarningsAsErrors);NU1605;NU1608;NU1701;NU1702;</WarningsAsErrors>
<NoWarn>$(NoWarn);IDE0058;IDE0290;IDE0130;</NoWarn>
<Deterministic>true</Deterministic>
<DebugType>portable</DebugType>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<IsTrimmable>true</IsTrimmable>
<TieredPGO>true</TieredPGO>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<RestoreLockedMode Condition="'$(CI)' == 'true'">true</RestoreLockedMode>
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
<MinVerTagPrefix>v</MinVerTagPrefix>
<MinVerDefaultPreReleaseIdentifiers>preview</MinVerDefaultPreReleaseIdentifiers>
<AssemblyVersion>$(MinVerMajor).$(MinVerMinor).$(GITHUB_RUN_NUMBER).$(MinVerPatch)</AssemblyVersion>
<FileVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).$(GITHUB_RUN_NUMBER)</FileVersion>
</PropertyGroup>
<!-- ================ Package properties for all vm2 packages ================ -->
<PropertyGroup Label="NuGetCommon">
<IsPackable>true</IsPackable>
<Company>vm</Company>
<Product>vm2</Product>
<ProductName>vm2 packages and tools</ProductName>
<Authors>Val Melamed</Authors>
<Copyright>Copyright ©2025 vm</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<RepositoryType>git</RepositoryType>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EnablePackageValidation>true</EnablePackageValidation>
<EmbedAllSources>true</EmbedAllSources>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
</PropertyGroup>
<!-- Print version info after build for all projects -->
<Target Name="PrintVersion" AfterTargets="Build">
<Message Importance="high" Text="AssemblyVersion: $(AssemblyVersion)" />
<Message Importance="high" Text="FileVersion: $(FileVersion)" />
<Message Importance="high" Text="InformationalVersion: $(InformationalVersion)" />
<Message Importance="high" Text="PackageVersion: $(PackageVersion)" />
<Message Importance="high" Text="Version: $(Version)" />
</Target>
<!-- ================ Common Package References for All projects ================ -->
<ItemGroup>
<PackageReference Include="System.Configuration.ConfigurationManager" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection"/>
<PackageReference Include="Microsoft.Extensions.Hosting"/>
<PackageReference Include="Microsoft.Extensions.Logging"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions"/>
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" />
<PackageReference Include="Microsoft.Extensions.Logging.Console"/>
<PackageReference Include="Microsoft.SourceLink.GitHub">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="MinVer">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<!-- ================ Test Projects Settings ================ -->
<!-- Test stack:
Microsoft Testing Platform (MTP) with
xUnit,
FluentAssertions
For *.Tests projects in the ./test folder:
-->
<!-- ================ Property to be used in condition attributes for detecting test projects ================ -->
<PropertyGroup>
<IsTestProject Condition="
$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectDirectory), '[/\\]tests?[/\\]', RegexOptions.IgnoreCase))
AND
$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectName), '.*\.Tests$', RegexOptions.IgnoreCase))
">true</IsTestProject>
</PropertyGroup>
<PropertyGroup Condition="$(IsTestProject) == 'true'">
<!-- Test projects settings -->
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
<IncludeSymbols>False</IncludeSymbols>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<NoWarn>
$(NoWarn);
CS0618;CS1572;CS1573;CS1574;CS1591;CS1711;
CA1701;CA1702;CA1707;CA1806;CA2211;
IDE0021;IDE0022;IDE0039;IDE0065;IDE1006;IDE2000;IDE2002;IDE0058;IDE0290
</NoWarn>
<!-- Enable MTP v2 For more information on Microsoft Testing Platform support in xUnit.net, visit: https://xunit.net/docs/getting-started/v3/microsoft-testing-platform -->
<UseMicrosoftTestingPlatform>true</UseMicrosoftTestingPlatform>
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
<!-- MTP v2: Configure coverage with coverage.settings.xml -->
<!-- This ensures VS Code Test Explorer uses the same coverage exclusions as command-line runs -->
<TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --coverage --coverage-output-format cobertura --coverage-settings "$(RepoRoot)coverage.settings.xml"</TestingPlatformCommandLineArguments>
</PropertyGroup>
<ItemGroup Condition="$(IsTestProject) == 'true'">
<!-- Use MTP v2 for all environments - VS 2022 should support it -->
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" />
<PackageReference Include="xunit.v3.mtp-v2" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="vm2.TestUtilities" />
</ItemGroup>
<!-- Common usings for the test projects: -->
<ItemGroup Condition="$(IsTestProject) == 'true'">
<Using Include="Xunit" />
<Using Include="FluentAssertions" />
</ItemGroup>
<!-- Copy repo-level test configuration to test output directory -->
<ItemGroup Condition="$(IsTestProject) == 'true'">
<Content Include="$(RepoRoot)testconfig.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<!-- ================ Test Library Projects' Settings ================ -->
<!-- Test stack:
Microsoft Testing Platform (MTP) with
xUnit,
FluentAssertions
For non-test projects in the ./test folder (utilities, extensions, etc.):
-->
<!-- ================ Property to be used in condition attributes for detecting test library projects (utilities, extensions, etc.) ================ -->
<PropertyGroup>
<IsTestLibraryProject Condition="
$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectDirectory), '[/\\]tests?[/\\]', RegexOptions.IgnoreCase))
AND
!$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectName), '.*\.Tests$', RegexOptions.IgnoreCase))
">true</IsTestLibraryProject>
</PropertyGroup>
<PropertyGroup Condition="$(IsTestLibraryProject) == 'true'">
<!-- Test libraries projects settings -->
<IsPackable>false</IsPackable>
<IncludeSymbols>False</IncludeSymbols>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<NoWarn>
$(NoWarn);
CS0618;CS1572;CS1573;CS1574;CS1591;CS1711;
CA1701;CA1702;CA1707;CA1806;CA2211;
IDE0021;IDE0022;IDE0039;IDE0065;IDE1006;IDE2000;IDE2002;IDE0058;IDE0290</NoWarn>
</PropertyGroup>
<ItemGroup Condition="$(IsTestLibraryProject) == 'true'">
<PackageReference Include="FluentAssertions" />
<PackageReference Include="xunit.v3.extensibility.core" />
</ItemGroup>
<!-- Common usings for test library projects in the ./test folder: -->
<ItemGroup Condition="$(IsTestLibraryProject) == 'true'">
<Using Include="Xunit" />
<Using Include="FluentAssertions" />
<Using Include="FluentAssertions.Formatting" />
<Using Include="FluentAssertions.Extensibility" />
</ItemGroup>
<!-- ================ Benchmark Projects Settings ================ -->
<!-- Stack:
BenchmarkDotNet
-->
<!-- ================ Property to be used in conditions about benchmarks ================ -->
<PropertyGroup>
<IsInBenchmarksFolder Condition="
$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectDirectory), '[/\\]benchmarks?[/\\]', RegexOptions.IgnoreCase))
">true</IsInBenchmarksFolder>
</PropertyGroup>
<PropertyGroup Condition="$(IsInBenchmarksFolder) == 'true'">
<!-- Test projects settings -->
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
<IncludeSymbols>False</IncludeSymbols>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<NoWarn>
$(NoWarn);
CS0618;CS1572;CS1573;CS1574;CS1591;CS1711;
CA1701;CA1702;CA1707;CA1806;CA2211;
IDE0021;IDE0022;IDE0039;IDE0065;IDE1006;IDE2000;IDE2002;IDE0058;IDE0290
</NoWarn>
<TieredPGO>false</TieredPGO>
<!-- To show up in the VS test explorer, see also below in the package references:
<RestorePackagesWithLockFile Condition="$(BuildingInsideVisualStudio) == 'true')">false</RestorePackagesWithLockFile>
-->
</PropertyGroup>
<!-- common packages for benchmark projects in the ./benchmarks folder: -->
<ItemGroup Condition="$(IsInBenchmarksFolder) == 'true'">
<PackageReference Include="BenchmarkDotNet" />
<PackageReference Include="BenchmarkDotNet.Annotations" />
<!-- To show up in the VS test explorer (with some perf. penalties!)
<PackageReference Include="BenchmarkDotNet.TestAdapter" />
-->
<!-- for running with Visual Studio profiler:
<PackageReference Include="Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers" />
-->
</ItemGroup>
<PropertyGroup>
<DefineConstants Condition="
$(IsInBenchmarksFolder) == 'true'
AND
'$(CI)' != 'true'
">$(DefineConstants);SHORT_RUN</DefineConstants>
</PropertyGroup>
<!-- common usings for benchmark projects in the ./benchmarks folder: -->
<ItemGroup Condition="$(IsInBenchmarksFolder) == 'true'">
<Using Include="BenchmarkDotNet" />
<Using Include="BenchmarkDotNet.Attributes" />
<Using Include="BenchmarkDotNet.Configs" />
<Using Include="BenchmarkDotNet.Jobs" />
<Using Include="BenchmarkDotNet.Order" />
<Using Include="BenchmarkDotNet.Running" />
</ItemGroup>
<!-- settings for example projects in the ./examples folder: -->
<!-- ================ Property to be used in conditions about examples projects ================ -->
<PropertyGroup>
<IsInExamplesFolder Condition="
$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectDirectory), '[/\\]examples?[/\\]', RegexOptions.IgnoreCase))
">true</IsInExamplesFolder>
</PropertyGroup>
<PropertyGroup Condition="$(IsInExamplesFolder) == 'true'">
<!-- Example projects settings -->
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>
<!-- Add project-specific properties and packages here -->
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" />
</ItemGroup>
</Project>