Versioning nuget package id using tfs online build format

I created a build with TFSOnline, currently it’s creating the nuget feed id using octopus build in versioning. I want to use TFS build version format to create the build, so I set octopackreleaseversion = $(Build.BuildNumber), I keep on getting an error in the build…what i am doing wrong?
There was an error calling NuGet. Please see the output above for more details. Command line: ‘C:\a\1\s\WebApplication2\packages\OctoPack.3.0.44\tools\NuGet.exe’ pack “C:\a\1\s\WebApplication2\WebApplication2\obj\octopacking\WebApplication2.nuspec” -NoPackageAnalysis -BasePath “C:\a\1\s\WebApplication2\WebApplication2” -OutputDirectory “C:\a\1\s\WebApplication2\WebApplication2\obj\octopacked” -Version $(Build.BuildNumber)

Hi,

Thanks for reaching out. Could you please try removing the parameter octopackreleaseversion = $(Build.BuildNumber) and instead adding /p:OctopackPackageVersion="$(TF_BUILD_BUILDNUMBER)"

Let me know how that goes,
Dalmiro

I have tried combination of bunch of variables to get the build number without any succes. I tried $(BUILD_BUILDNUMBER), $(Build.BuildNumber), $(TF_BUILD_BUILDNUMBER) without any success.

I also used a powershell script to find all the environment variables and their values, I got the result for BUILD_BUILDNUMBER as 1.0.20160113.01

Specific error I am getting is :
’$(BUILD_BUILDNUMBER)’ is not a valid version string.
2>MSBUILD : OctoPack error OCTONUGET: ‘$(BUILD_BUILDNUMBER)’ is not a valid version string. [C:\a\1\s\WebApplication2\WebApplication2\WebApplication2.csproj]
Parameter name: version

System.Exception: There was an error calling NuGet. Please see the output above for more details. Command line: ‘C:\a\1\s\WebApplication2\packages\OctoPack.3.0.46\tools\NuGet.exe’ pack “C:\a\1\s\WebApplication2\WebApplication2\obj\octopacking\WebApplication2.nuspec” -NoPackageAnalysis -BasePath “C:\a\1\s\WebApplication2\WebApplication2” -OutputDirectory “C:\a\1\s\WebApplication2\WebApplication2\obj\octopacked” -Version $(BUILD_BUILDNUMBER)
at OctoPack.Tasks.CreateOctoPackPackage.RunNuGet(String specFilePath, String octopacking, String octopacked, String projectDirectory) in y:\work\1f6ae101e1fcba62\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 551
at OctoPack.Tasks.CreateOctoPackPackage.Execute() in y:\work\1f6ae101e1fcba62\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 188

Hi,

I just tested this and was able to make it work using /p:OctoPackPackageVersion=$(Build.BuildNumber).

See attached screenshots.

Dalmiro

Thank you for your help.