Modifying build.number from a script not reflected in AssemblyInfo patcher

In the first build step for a build, I am reading a major/minor version value from a file and appending the build number (see PowerShell below). This works well for the remaining build steps, but the modified build number isn't getting picked up by the AssemblyInfo patcher - it uses the original value (which is the build counter). Is there a way to have the AssemblyInfo patcher use the updated value? Is there a better way to update the build number from the file so that it is available to the AssemblyInfo patcher?

PowerShell in the first build step used to update the version.

  $majorMinor = Get-Content "$($base.dir)\current.ver"
  Write-Output "##teamcity[buildNumber '$majorMinor.$env:BUILD_NUMBER']"

The current.ver file contains: 4.1 (or some other major/minor string).

Thanks,
Erick

1 comment
Comment actions Permalink

As a build feature, AssemblyInfoPatcher starts working on the start of the build, i.e. it patches AssemblyInfo files before any steps are executed. The solution that comes to mind is to create separate build configuration that will determine the build number and provide it as a parameter, set up a dependency on in from your build, with AssemblyInfoPatcher set up to pick this reported parameter

0

Please sign in to leave a comment.