My Fileversion update script in AssemblyInfo.tt file is in below format.
"[assembly: AssemblyVersion("<#= this.MajorVersion #>.<#= this.MinorVersion #>.<#=DateTime.Now.Year%100#><#=DateTime.Now.DayOfYear/7+1#><#=(int)DateTime.Now.DayOfWeek#>.?")]"
In the place specified as "?", I want to get the rev:.r number generated by Azure Build. Or "?" should get auto-incremented for every Azure build of a day.
What is the better method I can follow to archive it.
You can add a PowerShell script that does it:
$buildNumber = $env:Build_BuildNumber
$split = $buildNumber.Split('.')
$revision = $split[$split.Count - 1]
$assemblyFile = path/to/assembly/file # e.g. $(build.sourcesdirectory)/project/assmeblyinfo.cs
((Get-Content -path $assemblyFile -Raw) -replace "#>.?" , "#>.$($revision)") | Set-Content -Path $assemblyFile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With