dotnet-msbuild-gitversion is a simple tool for stamping the VersionPrefix
element in the dotnet core .csproj projects, using GitVersion for generating the version number.
I have not bothered to create a proper integration at this point.
-
dotnet publish -c release -o {where ever you want it, possibly as a contained lib}
-
create a simple PreBuildEvent like :To make it work with cmd aswell, use a build target instead, that way, the SDK-implicit target is inported, and we can get nice things like the directory-variable below<PreBuildEvent>dotnet my-chosen-destination\dotnet-msbuild-gitversion.dll</PreBuildEvent>
that uses thedotnet
cli
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="dotnet $(SolutionDir)lib\dotnet-msbuild-gitversion\dotnet-msbuild-gitversion.dll" />
</Target>
Heavily based on https://github.com/ah-/dotnet-gitversion from Andreas Heider