Call GetGitVersion only once

This commit is contained in:
Julio C. Rocha 2024-05-10 05:54:25 -07:00
parent d073fb8b1d
commit c6b2750cfe
1 changed files with 6 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Target Name="GetGitVersion" BeforeTargets="PrepareForBuild" Condition="'$(NeedsVersioning)'=='true'">
<Target Name="GetGitVersion" BeforeTargets="PrepareForBuild" Condition="'$(GetGitVersionSet)'!='true'">
<Exec Command="git rev-parse HEAD" ConsoleToMsBuild="true" StandardOutputImportance="Low" EchoOff="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitRevision" />
</Exec>
@ -15,6 +15,10 @@
<Message Importance="High" Text="git rev: [$(GitRevision)]" />
<Message Importance="High" Text="git rev short: [$(GitRevisionShort)]" />
<Message Importance="High" Text="git rev count: [$(GitRevisionCount)]" />
<PropertyGroup>
<!-- Call only once per MSBuild invocation. -->
<GetGitVersionSet>true</GetGitVersionSet>
</PropertyGroup>
<ItemGroup>
<ClCompile>
<PreprocessorDefinitions>
@ -37,4 +41,4 @@
</ItemGroup>
</Target>
</Project>
</Project>