-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
75 lines (70 loc) · 3.64 KB
/
Copy pathDirectory.Build.props
File metadata and controls
75 lines (70 loc) · 3.64 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
<Project>
<!--
Applies to every project in the solution automatically (MSBuild convention:
any Directory.Build.props found by walking up from a project's folder is
imported implicitly, no <Import> needed in the .csproj files).
Slim release builds: only ship .NET/library satellite resource assemblies
(localized strings for things like System.CommandLine, FluentValidation,
etc., if any package pulls them in) for these languages instead of every
language the underlying packages support.
KNOWN LIMITATION: this property is NOT honored for the Windows App SDK's
own resources when WindowsAppSDKSelfContained=true and WindowsPackageType=
None (our deployment model) — see microsoft/WindowsAppSDK#4288. Those
WinAppSDK resource files still ship for every language WinAppSDK supports,
regardless of this setting. This property still trims whatever it can
(CommunityToolkit.Mvvm, Microsoft.Extensions.*, Microsoft.PowerShell.SDK,
and anything else with satellite assemblies), so it's worth keeping even
though it doesn't fully solve the "EN/DE/FR/IT only" goal on its own.
-->
<PropertyGroup>
<SatelliteResourceLanguages>en;de;fr;it</SatelliteResourceLanguages>
</PropertyGroup>
<!--
Single source of truth for the app version. Bump this on every release;
it flows into AssemblyVersion/FileVersion/InformationalVersion for every
project (incl. CMClientCenter.App), and the Settings → About section reads
it back at runtime via Assembly.GetName().Version.
-->
<PropertyGroup>
<Version>1.0.0</Version>
</PropertyGroup>
<!--
Stamps the short git commit hash into InformationalVersion, e.g.
"1.0.0+a1b2c3d". The .NET SDK does this automatically once SourceRevisionId
is set (IncludeSourceRevisionInInformationalVersion defaults to true) — no
SourceLink package required, we just need to populate SourceRevisionId
ourselves since we're not using SourceLink's git provider.
Runs before GetAssemblyVersion/GenerateAssemblyInfo so the value is in
place before AssemblyInfo is generated. Falls back silently (no crash, no
hash suffix) if git isn't on PATH or this is a source drop without a
.git folder (e.g. extracted from a zip) — IgnoreExitCode handles both.
-->
<Target Name="SetSourceRevisionIdFromGit"
BeforeTargets="GetAssemblyVersion;GenerateAssemblyInfo"
Condition="'$(SourceRevisionId)' == ''">
<Exec Command="git rev-parse --short=8 HEAD"
ConsoleToMSBuild="true"
IgnoreExitCode="true"
StandardOutputImportance="low"
EchoOff="true">
<Output TaskParameter="ConsoleOutput" PropertyName="_GitCommitHash" />
<Output TaskParameter="ExitCode" PropertyName="_GitExitCode" />
</Exec>
<!-- Second call is cheap (same process would be nicer, but Exec only
gives one ConsoleOutput per call) and flags a dirty working tree,
since "which commit" is only half the story when the app was built
from uncommitted local changes. -->
<Exec Command="git status --porcelain"
Condition="'$(_GitExitCode)' == '0'"
ConsoleToMSBuild="true"
IgnoreExitCode="true"
StandardOutputImportance="low"
EchoOff="true">
<Output TaskParameter="ConsoleOutput" PropertyName="_GitDirtyStatus" />
</Exec>
<PropertyGroup Condition="'$(_GitExitCode)' == '0' AND '$(_GitCommitHash)' != ''">
<SourceRevisionId Condition="'$(_GitDirtyStatus)' == ''">$(_GitCommitHash)</SourceRevisionId>
<SourceRevisionId Condition="'$(_GitDirtyStatus)' != ''">$(_GitCommitHash)-dirty</SourceRevisionId>
</PropertyGroup>
</Target>
</Project>