I've recently started using GitVersion to version my assemblies, and I love it!
I like to generate a .msi
file that reflects the version of the product being built. Hitherto, I was using this in my .wixproj
file:
<!-- [TPL] name the output file to include the version from theLocalServer assembly -->
<Target Name="BeforeBuild">
<GetAssemblyIdentity AssemblyFiles="$(SolutionDir)BuildOutput\$(Configuration)\TA.DigitalDomeworks.Server.exe">
<Output TaskParameter="Assemblies" ItemName="AssemblyVersions" />
</GetAssemblyIdentity>
<CreateProperty Value="$(OutputName).%(AssemblyVersions.Version)">
<Output TaskParameter="Value" PropertyName="TargetName" />
</CreateProperty>
<CreateProperty Value="$(TargetName)$(TargetExt)">
<Output TaskParameter="Value" PropertyName="TargetFileName" />
</CreateProperty>
<CreateProperty Value="$(TargetDir)$(TargetFileName)">
<Output TaskParameter="Value" PropertyName="TargetPath" />
</CreateProperty>
</Target>
This produces an output file with a name like:
TA.DigitalDomeworks.Installer.7.1.0.3.msi
I found this solution from this answer, which references this blog post. The 7.1.0.3
comes from the assembly version of the main assembly in the build, which in turn is being versioned by GitVersion during its own build.
However, what I'd really like is to use the FullSemVer
property, which can be seen here:
C:\Users\Tim\source\repos\TA.DigitalDomeworks [release/7.1 ↑1 +0 ~1 -0 !]> gitversion
{
"Major":7,
"Minor":1,
"Patch":0,
"PreReleaseTag":"beta.3",
"PreReleaseTagWithDash":"-beta.3",
"PreReleaseLabel":"beta",
"PreReleaseNumber":3,
"BuildMetaData":"",
"BuildMetaDataPadded":"",
"FullBuildMetaData":"Branch.release/7.1.Sha.77fa2c96ed9b0f5ab162d07052ef094e8ccfc8c5",
"MajorMinorPatch":"7.1.0",
"SemVer":"7.1.0-beta.3",
"LegacySemVer":"7.1.0-beta3",
"LegacySemVerPadded":"7.1.0-beta0003",
"AssemblySemVer":"7.1.0.3",
"FullSemVer":"7.1.0-beta.3",
"InformationalVersion":"7.1.0-beta.3+Branch.release/7.1.Sha.77fa2c96ed9b0f5ab162d07052ef094e8ccfc8c5",
"BranchName":"release/7.1",
"Sha":"77fa2c96ed9b0f5ab162d07052ef094e8ccfc8c5",
"NuGetVersionV2":"7.1.0-beta0003",
"NuGetVersion":"7.1.0-beta0003",
"CommitsSinceVersionSource":3,
"CommitsSinceVersionSourcePadded":"0003",
"CommitDate":"2018-09-10"
}
So the final filename I'd like to see is:
TA.DigitalDomeworks.Installer-7.1.0-Beta.3.msi
In the GitVersion documentation, it say that I need to make sure the GitVersion.GetVersion
build task has executed, after which I should be able to obtain the full SemVer from a build property called $(GitVersion_FullSemVer)
.
However, I'm not sure how to achieve that in a WiX project, since installing the GitVersionTask
NuGet package doesn't seem to do anything (in C# projects, everything just magically works). If I could get to the point where I can execute the GitVersion.GetVersion
task, then I think I can see my way clear to getting the output name I want.
Has anyone got this working? Or can anyone offer any advice on how to approach this?