Skip to content

Instantly share code, notes, and snippets.

@PadreSVK
Last active December 14, 2020 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PadreSVK/53f42138e58824c1805a117cbef15cf2 to your computer and use it in GitHub Desktop.
Save PadreSVK/53f42138e58824c1805a117cbef15cf2 to your computer and use it in GitHub Desktop.
Sample of .targets for solution wide additing git metadata dlls and autoincrement Versions based on GitVersion
<Project>
<PropertyGroup>
<StableVersionBranch>master</StableVersionBranch>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitVersionTask" Version="5.5.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<!-- do this only for non release branch, GitVersion_BuildMetaDataPadded contains count of commits against last stable build (based on git tag) -->
<Target Name="ChangeSuffixVersionForPrerelease" AfterTargets="GetVersion">
<PropertyGroup Condition="'$(GitVersion_BranchName)' != '$(StableVersionBranch)'">
<PackageVersion>$(GitVersion_MajorMinorPatch)-$(GitVersion_PreReleaseLabel)$(GitVersion_BuildMetaDataPadded)</PackageVersion>
</PropertyGroup>
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment