Repository navigation
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
70 lines (64 loc) · 4.25 KB
/
Copy pathDirectory.Build.props
File metadata and controls
70 lines (64 loc) · 4.25 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
<Project>
<!--
Versioning is by date: YEAR.MONTH.DAY.N (2026.11.13.1, no leading zeros), where the date is HEAD's commit date
(in the committer's own time zone) and N counts that day's commits on the first-parent line up to HEAD. So every
check-in gets a new, higher number, and any build of one commit - here or on the release runner - gets the same
one. N jumps when several commits go out in one push (one release, numbered by its last commit). The
informational version also carries the short commit SHA so a user's reported version pins the exact commit.
Falls back to 0.0.0.0+nogit when git isn't available (e.g. a source drop), so builds never fail on this; a
shallow clone undercounts N, so the release checkout takes full history.
AssemblyVersion stays 1.0.0.0 (stable, so assembly binding doesn't churn per commit).
FileVersion / InformationalVersion carry the real number for the .exe properties and the logs.
-->
<PropertyGroup>
<Company>RelentlessOldMan</Company>
<Product>CodeCompass</Product>
<CCVersion>0.0.0.0</CCVersion>
<CCGitSha>nogit</CCGitSha>
<!-- We already put the short SHA into InformationalVersion ourselves; stop the SDK from also
appending the full commit SHA (yields an ugly "2026.11.13.1+short.full" double-SHA). -->
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<!-- Pin the full transitive dependency graph in a committed packages.lock.json per project. Without it,
floating (>=) transitive versions can drift on any restore with no code change and no diff - exactly
how a net10-only System.Text.Json silently replaced the net8-compatible one and broke the published
MCP server between releases. With lockfiles, every restore uses the locked versions and any real graph
change is a reviewable diff. The release gate restores in locked mode so drift is a hard failure. -->
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<!-- The build is warning-free; keep it that way. Nullable is on everywhere, so a new possible-null dereference
is a build break here rather than a field NullReferenceException later. -->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<Target Name="CCStampVersion"
BeforeTargets="GetAssemblyVersion;GenerateAssemblyInfo"
Condition="'$(CCStamped)' != 'true'">
<!-- The days of HEAD and the commits before it: N is how many share HEAD's day. -->
<Exec Command="git log --first-parent -n 1000 --format=%25%25cd --date=format:%25%25Y.%25%25m.%25%25d HEAD" ConsoleToMSBuild="true"
ContinueOnError="true" StandardOutputImportance="low" StandardErrorImportance="low">
<Output TaskParameter="ConsoleOutput" ItemName="_CCDay" />
<Output TaskParameter="ExitCode" PropertyName="_CCDayRc" />
</Exec>
<Exec Command="git log -1 --format=%25%25cd --date=format:%25%25Y.%25%25m.%25%25d HEAD" ConsoleToMSBuild="true"
ContinueOnError="true" StandardOutputImportance="low" StandardErrorImportance="low">
<Output TaskParameter="ConsoleOutput" PropertyName="_CCHeadDay" />
<Output TaskParameter="ExitCode" PropertyName="_CCHeadDayRc" />
</Exec>
<Exec Command="git rev-parse --short=8 HEAD" ConsoleToMSBuild="true" ContinueOnError="true"
StandardOutputImportance="low" StandardErrorImportance="low">
<Output TaskParameter="ConsoleOutput" PropertyName="_CCSha" />
<Output TaskParameter="ExitCode" PropertyName="_CCShaRc" />
</Exec>
<ItemGroup>
<_CCSameDay Include="@(_CCDay)" Condition="'%(Identity)' == '$(_CCHeadDay)'" />
</ItemGroup>
<PropertyGroup>
<_CCN>@(_CCSameDay->Count())</_CCN>
<CCVersion Condition="'$(_CCDayRc)' == '0' and '$(_CCHeadDayRc)' == '0' and '$(_CCHeadDay)' != ''">$([System.Version]::Parse('$(_CCHeadDay).$(_CCN)').ToString())</CCVersion>
<CCGitSha Condition="'$(_CCShaRc)' == '0' and '$(_CCSha)' != ''">$(_CCSha)</CCGitSha>
<Version>$(CCVersion)</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>$(CCVersion)</FileVersion>
<InformationalVersion>$(CCVersion)+$(CCGitSha)</InformationalVersion>
<CCStamped>true</CCStamped>
</PropertyGroup>
</Target>
</Project>