-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDirectory.Build.targets
29 lines (29 loc) · 1.49 KB
/
Directory.Build.targets
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
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Target Name="SetVersionAttributes" BeforeTargets="InitializeSourceControlInformation">
<Exec
Command="git describe --long --always --dirty --exclude=* --abbrev=8"
ConsoleToMSBuild="True"
IgnoreExitCode="False"
>
<Output PropertyName="GitRevision" TaskParameter="ConsoleOutput"/>
</Exec>
<Exec Command="git describe --tag --abbrev=0" ConsoleToMSBuild="True" IgnoreExitCode="False">
<Output PropertyName="GitVersion" TaskParameter="ConsoleOutput"/>
</Exec>
<CreateProperty Value="$([System.Text.RegularExpressions.Regex]::Match($(GitVersion), [^v].*))">
<Output TaskParameter="Value" PropertyName="GitVersion"/>
</CreateProperty>
<CreateProperty Value="$([System.Text.RegularExpressions.Regex]::Match($(GitVersion), \d+\.\d+.\d+))">
<Output TaskParameter="Value" PropertyName="GitNumericVersion"/>
</CreateProperty>
<PropertyGroup>
<BuildVersion>$(GitVersion)-$(GitRevision)</BuildVersion>
<InformationalVersion>$(BuildVersion)</InformationalVersion>
<FileVersion>$(GitNumericVersion).0</FileVersion>
<AssemblyVersion>$(GitNumericVersion)</AssemblyVersion>
<PackageVersion>$(GitNumericVersion)</PackageVersion>
</PropertyGroup>
<Message Text="Build version = $(InformationalVersion)" Importance="high"/>
</Target>
</Project>