Build Version

In TFS, when building using OctoPack as build parameters, /p:RunOctoPack=true /p:OctoPackPublishPackageToHttp=https//… the Octopack generated package contains the package version reflected in my assembly.info. If I have my assembly.info 1.1.0.* the package version will reflect that pattern. When I switch to Package Application Task followed by a Push Package to Octopus, I lose the version pattern from assembly. info and it uses $(Build.BuildNumber). How can I retain the version from assembly.info in the Package Application Task?

Hi Daniel,

Thanks for reaching out! In the context of the Push step, there’s no variable that could reference the value of your Assembly.Info. What we recommend in these cases is not to rely on your Assembly.info for everything, and instead use $(build.buildnumber) for all things like:

  • Versioning your assemblies.
  • Versioning your nuget package.
  • Versioning your Octopus release created during the build.

This way you’ll be able to know which build correlates with which assembly version, package or release at a simple glance at all times.

All that said, if you want to stick with the Assembly Version, you could create a Powershell script step that gets this value from your alread-compiled-assembly and creates an output variable from it. Then you’d use that output variable in the “package” step.

Info on how to create an output variable in TFS: https://roadtoalm.com/2016/08/11/set-output-variable-in-a-powershell-vsts-build-task/

Hope that helps!
Dalmiro