21 lines
896 B
Text
21 lines
896 B
Text
|
|
<Project>
|
||
|
|
<PropertyGroup>
|
||
|
|
<!-- Default-Version, falls kein Git-Tag vorhanden -->
|
||
|
|
<Version>0.1.0</Version>
|
||
|
|
</PropertyGroup>
|
||
|
|
|
||
|
|
<Target Name="SetVersionFromGit" BeforeTargets="GetAssemblyVersion;Build;Publish">
|
||
|
|
<Exec Command="git describe --tags --abbrev=0 2>nul" ConsoleToMSBuild="true" IgnoreExitCode="true">
|
||
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="GitTagRaw" />
|
||
|
|
</Exec>
|
||
|
|
<PropertyGroup>
|
||
|
|
<!-- v1.2.3 → 1.2.3 -->
|
||
|
|
<GitTagClean>$(GitTagRaw.TrimStart('v').Trim())</GitTagClean>
|
||
|
|
<Version Condition="'$(GitTagClean)' != ''">$(GitTagClean)</Version>
|
||
|
|
<AssemblyVersion Condition="'$(GitTagClean)' != ''">$(GitTagClean).0</AssemblyVersion>
|
||
|
|
<FileVersion Condition="'$(GitTagClean)' != ''">$(GitTagClean).0</FileVersion>
|
||
|
|
</PropertyGroup>
|
||
|
|
<Message Text="Build-Version: $(Version)" Importance="high" />
|
||
|
|
</Target>
|
||
|
|
</Project>
|