Octopus - version incrementing error

Hi,

I’m trying to auto increment the version number when building. I tried below options in MSBuild Arguments. Always getting an error, can you please help me with this?

/p:RunOctoPack=true /p:OctoPackPublishPackageToFileShare=\\Repository* /p:OctoPackEnforceAddingFiles=true /p:OctoPackPackageVersion=1.0.$(Build.BuildNumber)
/p:RunOctoPack=true /p:OctoPackPublishPackageToFileShare=\
\Repository* /p:OctoPackEnforceAddingFiles=true /p:OctoPackPackageVersion=$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)
/p:RunOctoPack=true /p:OctoPackPublishPackageToFileShare=\***\Repository* /p:OctoPackEnforceAddingFiles=true /p:OctoPackPackageVersion=$(TF_BUILD_BUILDNUMBER)

But always getting error as below:
Version string specified for package reference ‘1.0.$(Build.BuildNumber)’ is invalid.
There was an error calling NuGet. Please see the output above for more details. Command line: 'D:***WebAPP.nuspec" -NoPackageAnalysis -BasePath "**WebApp" -OutputDirectory “*****WebApp\obj\octopacked” -Version 1.0.$(Build.BuildNumber)
System.Exception: There was an error calling NuGet. Please see the output above for more details.

i’m using TFS2012.

Hi Priya,

Thanks for getting in touch.

It looks like the $(Build.BuildNumber) variable isn’t being replaced. It’s a variable that’s only used in the new Team Foundation Build system, so you’d have to be using that to get it to work.

Can you answer a few questions for me?

  1. Which of those arguments are you using together? It looks like there are a lot of repeated ones in your list.
  2. How are you running MSBuild? Are you using a VSTS or TFS build engine? Or are you adding these arguments another way?

Thanks,
Damian