-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
44 lines (37 loc) · 1.6 KB
/
Directory.Build.targets
File metadata and controls
44 lines (37 loc) · 1.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
<Project InitialTargets="Initialize">
<!-- we dont care about people not being compatible with SemVer 2.0 anymore -->
<PropertyGroup>
<NoWarn>NU5105;$(NoWarn)</NoWarn>
</PropertyGroup>
<Target Name="ExtractCurrentGitHash">
<Exec Command="git rev-parse HEAD" EchoOff="true" ConsoleToMSBuild="true" StandardOutputImportance="low">
<Output TaskParameter="ConsoleOutput" PropertyName="CurrentHead" />
</Exec>
</Target>
<Target Name="AttachDevVersionSuffix" Condition="'$(BuildType)' == 'dev'">
<CreateProperty Value="$(Version)-dev-$([System.DateTime]::Now.ToString(yyyyMMdd-HHmmss))">
<Output TaskParameter="Value" PropertyName="Version" />
<Output TaskParameter="Value" PropertyName="PackageVersion" />
</CreateProperty>
</Target>
<Target Name="AttachPrereleaseVersionSuffix" Condition="'$(BuildType)' == 'prerelease'">
<CreateProperty Value="$(Version)-pre-$(CurrentHead)">
<Output TaskParameter="Value" PropertyName="Version" />
<Output TaskParameter="Value" PropertyName="PackageVersion" />
</CreateProperty>
</Target>
<Target Name="AttachReleaseVersionSuffix" Condition="'$(BuildType)' == 'release'">
<CreateProperty Value="$(Version)-$(CurrentHead)">
<Output TaskParameter="Value" PropertyName="Version" />
</CreateProperty>
</Target>
<PropertyGroup>
<InitializeDependsOn>
ExtractCurrentGitHash;
AttachDevVersionSuffix;
AttachPrereleaseVersionSuffix;
AttachReleaseVersionSuffix
</InitializeDependsOn>
</PropertyGroup>
<Target Name="Initialize" DependsOnTargets="$(InitializeDependsOn)" />
</Project>