Repository navigation
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
40 lines (38 loc) · 2.14 KB
/
Copy pathDirectory.Build.props
File metadata and controls
40 lines (38 loc) · 2.14 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
<Project>
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AnalysisLevel>latest-recommended</AnalysisLevel>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<NuGetAudit>true</NuGetAudit>
<NuGetAuditMode>all</NuGetAuditMode>
<NuGetAuditLevel>low</NuGetAuditLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<EnableDefaultCompressionFormats>false</EnableDefaultCompressionFormats>
<PublishCompressionFormats>brotli</PublishCompressionFormats>
</PropertyGroup>
<!-- The one version source: assembly metadata BuildVersion = vYYMMDD (UTC date of the HEAD commit, falling back to
the UTC build date). The header badge, /api/diag and /health/live all read BuildVersion. -->
<Target Name="PoBuildStamp" BeforeTargets="GetAssemblyAttributes;CoreCompile">
<Exec Condition="'$(PoStamp)' == ''" Command="git rev-list -1 --timestamp HEAD" WorkingDirectory="$(MSBuildThisFileDirectory)"
ConsoleToMSBuild="true" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true"
StandardOutputImportance="low" StandardErrorImportance="low">
<Output TaskParameter="ConsoleOutput" PropertyName="_PoHeadCommit" />
<Output TaskParameter="ExitCode" PropertyName="_PoHeadCommitExit" />
</Exec>
<PropertyGroup>
<PoStamp Condition="'$(PoStamp)' == '' and '$(_PoHeadCommitExit)' == '0' and '$(_PoHeadCommit)' != '' and $([System.Text.RegularExpressions.Regex]::IsMatch('$(_PoHeadCommit.Split(` `)[0])', '^\d+$'))">$([System.DateTime]::UnixEpoch.AddSeconds($(_PoHeadCommit.Split(' ')[0])).ToString('yyMMdd'))</PoStamp>
<PoStamp Condition="'$(PoStamp)' == ''">$([System.DateTime]::UtcNow.ToString('yyMMdd'))</PoStamp>
</PropertyGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>BuildVersion</_Parameter1>
<_Parameter2>$(PoStamp)</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
</Target>
</Project>